{$CLEO .cs}

nop
wait 3000

int supplierMarker, buyerMarker, supplierBlip, buyerBlip, buyerDiscovered, briefcaseBlip
int inSupplier, inBuyer, seedPacks, weedGrams, sellMenu
int missionStage, firstSaleTextShown, gramsSoldSinceHeat, totalGramsSold
int nowTime, elapsed, activePlants, maxPlants
int heatLevel, heatCooldown
int $weedIconLoaded
int $weedIconUntil

int $drugHeat
int $akSeedPacks
int $akWeedGrams
int $mission2Unlocked
int $mission2Started
int $mission2Complete
int $mission2Ready
int $mission2AutoStart
int $mission3Ready
int $mission3Unlocked
int $mission3Started
int $mission3Harvested
int $mission3PhoneDone
int $mission3ContactSpawned
int $mission4Started
int $mission4AkHarvested
int $mission4Complete
int $hillPlantDone1
int $hillPlantDone2
int $hillPlantDone3
int $hillPlantDone4
int $hillPrompt1
int $hillPrompt2
int $hillPrompt3
int $hillPrompt4
int $hillPlantBlip1
int $hillPlantBlip2
int $hillPlantBlip3
int $hillPlantBlip4
int $hillGuardsSpawned
int $growhouseMarker
int $growhouseBlip
int $growhouseOwned
int $growhousePrompt
int $growhouseTyrellCallDone
int $palominoContactMarker
int $palominoContactBlip
int $palominoContactTalked
int $palominoPrompt
int $mission5Started
int $mission5CallDone
int $isaacSpawned
int $isaacDiscovered
int $isaacMarker
int $isaacBlip
int $isaacPrompt
int $mission6Started
int $mission6SoldGrams
int $slingingUnlocked
int $slingingRepBeach
int $slingCustomerActive
int $slingCustomerMenu
int $slingCustomerPrompt
int $slingCustomerBlip
int $slingCustomerMarker
int $slingNextSpawn
int $slingThanks
int $slingSpawnIndex
int $slingDeals
int $slingDealsSinceHeat
int $slingSalePrice
int $ecstasyPills
int $poppySeeds
int $opiumGrams
int $heroinGrams
int $mission7Started
int $chemistUnlocked
int $chemistSpawned
int $chemistDiscovered
int $chemistPrompt
int $chemistBlip
int $chemistQuestionBlip
int $chemistMarker
int $chemistCallDone
int $ecstasyDealerSpawned
int $ecstasyDealerPrompt
int $ecstasyDealerMenu
int $ecstasyDealerBlip
int $ecstasyDealerMarker
int $ecstasyDealerDeals
int $ecstasyDealerStage
int $ecstasyPackSize
int $lsdTabs
int $mushroomPacks
int $mayaUnlocked
int $mayaIntroSpawned
int $mayaIntroActorSpawned
int $mayaObjectiveStarted
int $mayaPrompt
int $mayaBlip
int $mayaMarker
int $mayaMenu
int $nightlifeSlingingUnlocked
int $nightlifeActive
int $nightlifeRep
int $nightCustomerActive
int $nightCustomerMenu
int $nightCustomerPrompt
int $nightCustomerBlip
int $nightCustomerMarker
int $nightNextSpawn
int $nightSpawnIndex
int $nightCustomerModel
int $mission9Started
int $mission9Sales
int $slingCustomerModel
int $beachCrowdSpawned
int $tyrellCallTime
int $tyrellCrewSpawned
int $tyrellPrompt
int $tyrellMenu
int $workerSeeds
int $workerGrowStart
int $workerHarvestReady
int $workerHarvestGrams
int $workerAkActive
int $workerAkStart
int $workerAkReady
int $rewardRoll
int $seedRoll
int $harvestedCrops
int $regularHarvestedGrams
int $supplierAkTalkUnlocked
int $supplierAkTalkDone
int $hillGrowUnlocked
int $akFirstSaleCallPending
int $akFirstSaleCallShown
int $akSaleCallStart
int $mission8Unlocked
int $mission8Started
int $mission8Complete
int $farmGuardsSpawned
int $farmMarker
int $farmBlip
int $farmOwned
int $farmPrompt
int $farmCrewSpawned
int $farmWorkerPrompt
int $farmWorkerMenu
int $farmAkSeeds
int $farmPoppySeeds
int $farmGrowStart
int $farmHarvestReady
int $farmAkReadyGrams
int $farmOpiumReady
int $farmCocaSeeds
int $farmCocaLeavesReady
int $farmCocaSeedsReady
int $farmCocaAutoStarted
int $morganFarmUpgradeBought
int $morganFarmMoved
int $morganFarmPrompt
int $morganMenu
int $morganProcessDeals
int $morganLsdReady
int $smuggleActive
int $smuggleBlip
int $smuggleMarker
int $smuggleLoad
int $smugglePrompt
int $smuggleRoute
int $smuggleStage
int $empirePhaseUnlocked
int $empireSupplierCallDone
int $mexicanContactSpawned
int $mexicanContactActorSpawned
int $mexicanContactTalked
int $mexicanPrompt
int $mexicanBlip
int $mexicanMarker
int $mysterySeeds
int $cocaSeeds
int $cocaLeaves
int $cocaineGrams
int $cocaPlanted
int $cocaReady
int $cocaStage
int $cocaPrompt
int $cocaStart
int $cocaGrowTicks
int $cocaBlip
int $cocaineBreakthroughDone
int $growhouseSecurityBought
int $growhouseSecuritySpawned

int $planted1
int $planted2
int $plantType1
int $plantType2
int $plantReady1
int $plantReady2
int $growStage1
int $growStage2
int $harvestPrompt1
int $harvestPrompt2
int $plantStart1
int $plantStart2
int $plantBlip1
int $plantBlip2
int $poppyPlanted
int $poppyReady
int $poppyStage
int $poppyPrompt
int $poppyStart
int $poppyBlip
int $drugMenuUntil
int $drugMenuPage
int $dbSavePrompt
int $dbSaveSlotUsed
int $dbSaveSeedPacks
int $dbSaveWeedGrams
int $dbSaveMissionStage
int $dbSaveFirstSaleTextShown
int $dbSaveTotalGramsSold
int $dbSaveMaxPlants
int $dbSaveHarvestedCrops
int $dbSaveRegularHarvestedGrams
int $dbSaveDrugHeat
int $dbSaveAkSeedPacks
int $dbSaveAkWeedGrams
int $dbSaveEcstasyPills
int $dbSavePoppySeeds
int $dbSaveOpiumGrams
int $dbSaveHeroinGrams
int $dbSaveLsdTabs
int $dbSaveMushroomPacks
int $dbSaveMysterySeeds
int $dbSaveCocaSeeds
int $dbSaveCocaLeaves
int $dbSaveCocaineGrams
int $dbSaveMission2Ready
int $dbSaveMission2Complete
int $dbSaveMission3Ready
int $dbSaveMission3PhoneDone
int $dbSaveMission4Complete
int $dbSaveMission5CallDone
int $dbSaveMission6Started
int $dbSaveSlingingUnlocked
int $dbSaveSlingingRepBeach
int $dbSaveSlingDeals
int $dbSaveChemistUnlocked
int $dbSaveChemistDiscovered
int $dbSaveEcstasyDealerStage
int $dbSaveMayaUnlocked
int $dbSaveNightlifeUnlocked
int $dbSaveNightlifeRep
int $dbSaveGrowhouseOwned
int $dbSaveTyrellCrewSpawned
int $dbSaveWorkerSeeds
int $dbSaveWorkerHarvestReady
int $dbSaveWorkerHarvestGrams
int $dbSaveWorkerAkActive
int $dbSaveFarmOwned
int $dbSaveFarmCrewSpawned
int $dbSaveFarmAkSeeds
int $dbSaveFarmPoppySeeds
int $dbSaveFarmCocaSeeds
int $dbSaveFarmHarvestReady
int $dbSaveMorganFarmMoved
int $dbSaveMorganDeals
int $dbSaveMorganLsdReady
int $dbSaveEmpirePhaseUnlocked
int $dbSaveMexicanContactTalked
int $dbSaveCocaineBreakthroughDone
int $dbSaveMoney
int $dbSaveCurrentMoney

float $plant1X
float $plant1Y
float $plant1Z
float $plant2X
float $plant2Y
float $plant2Z
float $slingCustomerX
float $slingCustomerY
float $slingCustomerZ
float $nightCustomerA
float $poppyX
float $poppyY
float $poppyZ
float $cocaX
float $cocaY
float $cocaZ

Char $supplier
Char $buyer
Char $vagosEnemy
Char $hillGuard1
Char $hillGuard2
Char $hillGuard3
Char $hillGuard4
Char $palominoContact
Char $isaac
Char $slingCustomer
Char $beachPed1
Char $beachPed2
Char $beachPed3
Char $beachPed4
Char $ecstasyDealer
Char $maya
Char $nightCustomer
Char $chemist
Char $tyrell
Char $groveWorker
Char $growhouseSecurityGuard
Char $farmGuard1
Char $farmGuard2
Char $farmGuard3
Char $farmWorker1
Char $farmWorker2
Char $mexicanContact
Car $smuggleTruck
Object $weedPlant1
Object $weedPlant2
Object $hillPlant1
Object $hillPlant2
Object $hillPlant3
Object $hillPlant4
Object $workerAkPlant
Object $poppyPlant
Object $cocaPlant
Object $farmPoppyPlant
Object $farmPoppyPlant2
Object $farmPoppyPlant3
Object $farmPoppyPlant4
Object $farmAkPlant
Object $farmAkPlant2
Object $farmAkPlant3
Object $farmAkPlant4
Object $farmCocaPlant
Object $farmCocaPlant2
Object $farmCocaPlant3
Object $farmCocaPlant4
Object $labTable
Object $labPack1
Object $labPack2
Object $missionBriefcase

supplierMarker = -1
buyerMarker = -1
supplierBlip = -1
buyerBlip = -1
buyerDiscovered = 0
briefcaseBlip = -1
inSupplier = 0
inBuyer = 0
seedPacks = 0
weedGrams = 0
sellMenu = 0
missionStage = 1
firstSaleTextShown = 0
gramsSoldSinceHeat = 0
totalGramsSold = 0
maxPlants = 1
activePlants = 0
heatLevel = 0
heatCooldown = 0

$drugHeat = 0
$akSeedPacks = 0
$akWeedGrams = 0
$mission2Unlocked = 0
$mission2Started = 0
$mission2Complete = 0
$mission2Ready = 0
$mission2AutoStart = 0
$mission3Ready = 0
$mission3Unlocked = 0
$mission3Started = 0
$mission3Harvested = 0
$mission3PhoneDone = 0
$mission3ContactSpawned = 0
$mission4Started = 0
$mission4AkHarvested = 0
$mission4Complete = 0
$hillPlantDone1 = 0
$hillPlantDone2 = 0
$hillPlantDone3 = 0
$hillPlantDone4 = 0
$hillPrompt1 = 0
$hillPrompt2 = 0
$hillPrompt3 = 0
$hillPrompt4 = 0
$hillPrompt1 = 0
$hillPrompt2 = 0
$hillPrompt3 = 0
$hillPrompt4 = 0
$hillPlantBlip1 = -1
$hillPlantBlip2 = -1
$hillPlantBlip3 = -1
$hillPlantBlip4 = -1
$hillGuardsSpawned = 0
$growhouseMarker = -1
$growhouseBlip = -1
$growhouseOwned = 0
$growhousePrompt = 0
$growhouseTyrellCallDone = 0
$palominoContactMarker = -1
$palominoContactBlip = -1
$palominoContactTalked = 0
$palominoPrompt = 0
$mission5Started = 0
$mission5CallDone = 0
$isaacSpawned = 0
$isaacDiscovered = 0
$isaacMarker = -1
$isaacBlip = -1
$isaacPrompt = 0
$mission6Started = 0
$mission6SoldGrams = 0
$slingingUnlocked = 0
$slingingRepBeach = 0
$slingCustomerActive = 0
$slingCustomerMenu = 0
$slingCustomerPrompt = 0
$slingCustomerBlip = -1
$slingCustomerMarker = -1
$slingNextSpawn = 0
$slingThanks = 0
$slingSpawnIndex = 0
$slingDeals = 0
$slingDealsSinceHeat = 0
$slingSalePrice = 0
$beachCrowdSpawned = 0
$ecstasyPills = 0
$poppySeeds = 0
$opiumGrams = 0
$heroinGrams = 0
$mission7Started = 0
$chemistUnlocked = 0
$chemistSpawned = 0
$chemistDiscovered = 0
$chemistPrompt = 0
$chemistBlip = -1
$chemistQuestionBlip = -1
$chemistMarker = -1
$chemistCallDone = 0
$ecstasyDealerSpawned = 0
$ecstasyDealerPrompt = 0
$ecstasyDealerMenu = 0
$ecstasyDealerBlip = -1
$ecstasyDealerMarker = -1
$ecstasyDealerDeals = 0
$ecstasyDealerStage = 0
$ecstasyPackSize = 5
$lsdTabs = 0
$mushroomPacks = 0
$mayaUnlocked = 0
$mayaIntroSpawned = 0
$mayaIntroActorSpawned = 0
$mayaObjectiveStarted = 0
$mayaPrompt = 0
$mayaBlip = -1
$mayaMarker = -1
$mayaMenu = 0
$nightlifeSlingingUnlocked = 0
$nightlifeActive = 0
$nightlifeRep = 0
$nightCustomerActive = 0
$nightCustomerMenu = 0
$nightCustomerPrompt = 0
$nightCustomerBlip = -1
$nightCustomerMarker = -1
$nightNextSpawn = 0
$nightSpawnIndex = 0
$nightCustomerModel = 7
$mission9Started = 0
$mission9Sales = 0
$slingCustomerModel = 7
$tyrellCallTime = 0
$tyrellCrewSpawned = 0
$tyrellPrompt = 0
$tyrellMenu = 0
$workerSeeds = 0
$workerGrowStart = 0
$workerHarvestReady = 0
$workerHarvestGrams = 0
$workerAkActive = 0
$workerAkStart = 0
$workerAkReady = 0
$rewardRoll = 0
$seedRoll = 0
$harvestedCrops = 0
$regularHarvestedGrams = 0
$supplierAkTalkUnlocked = 0
$supplierAkTalkDone = 0
$hillGrowUnlocked = 0
$akFirstSaleCallPending = 0
$akFirstSaleCallShown = 0
$akSaleCallStart = 0
$mission8Unlocked = 0
$mission8Started = 0
$mission8Complete = 0
$farmGuardsSpawned = 0
$farmMarker = -1
$farmBlip = -1
$farmOwned = 0
$farmPrompt = 0
$farmCrewSpawned = 0
$farmWorkerPrompt = 0
$farmWorkerMenu = 0
$farmAkSeeds = 0
$farmPoppySeeds = 0
$farmGrowStart = 0
$farmHarvestReady = 0
$farmAkReadyGrams = 0
$farmOpiumReady = 0
$farmCocaSeeds = 0
$farmCocaLeavesReady = 0
$farmCocaSeedsReady = 0
$farmCocaAutoStarted = 0
$morganFarmUpgradeBought = 0
$morganFarmMoved = 0
$morganFarmPrompt = 0
$morganMenu = 0
$morganProcessDeals = 0
$morganLsdReady = 0
$smuggleActive = 0
$smuggleBlip = -1
$smuggleMarker = -1
$smuggleLoad = 0
$smugglePrompt = 0
$smuggleRoute = 0
$smuggleStage = 0
$empirePhaseUnlocked = 0
$empireSupplierCallDone = 0
$mexicanContactSpawned = 0
$mexicanContactActorSpawned = 0
$mexicanContactTalked = 0
$mexicanPrompt = 0
$mexicanBlip = -1
$mexicanMarker = -1
$mysterySeeds = 0
$cocaSeeds = 0
$cocaLeaves = 0
$cocaineGrams = 0
$cocaPlanted = 0
$cocaReady = 0
$cocaStage = 0
$cocaPrompt = 0
$cocaStart = 0
$cocaGrowTicks = 0
$cocaBlip = -1
$cocaineBreakthroughDone = 0
$growhouseSecurityBought = 0
$growhouseSecuritySpawned = 0

$planted1 = 0
$planted2 = 0
$plantType1 = 0
$plantType2 = 0
$plantReady1 = 0
$plantReady2 = 0
$growStage1 = 0
$growStage2 = 0
$harvestPrompt1 = 0
$harvestPrompt2 = 0
$plantStart1 = 0
$plantStart2 = 0
$plantBlip1 = -1
$plantBlip2 = -1
$poppyPlanted = 0
$poppyReady = 0
$poppyStage = 0
$poppyPrompt = 0
$poppyStart = 0
$poppyBlip = -1
$drugMenuUntil = 0
$drugMenuPage = 0
$weedIconLoaded = 0
$weedIconUntil = 0
$dbSavePrompt = 0
$dbSaveSlotUsed = 0
$dbSaveSeedPacks = 0
$dbSaveWeedGrams = 0
$dbSaveMissionStage = 1
$dbSaveFirstSaleTextShown = 0
$dbSaveTotalGramsSold = 0
$dbSaveMaxPlants = 1
$dbSaveHarvestedCrops = 0
$dbSaveRegularHarvestedGrams = 0
$dbSaveDrugHeat = 0
$dbSaveAkSeedPacks = 0
$dbSaveAkWeedGrams = 0
$dbSaveEcstasyPills = 0
$dbSavePoppySeeds = 0
$dbSaveOpiumGrams = 0
$dbSaveHeroinGrams = 0
$dbSaveLsdTabs = 0
$dbSaveMushroomPacks = 0
$dbSaveMysterySeeds = 0
$dbSaveCocaSeeds = 0
$dbSaveCocaLeaves = 0
$dbSaveCocaineGrams = 0
$dbSaveMission2Ready = 0
$dbSaveMission2Complete = 0
$dbSaveMission3Ready = 0
$dbSaveMission3PhoneDone = 0
$dbSaveMission4Complete = 0
$dbSaveMission5CallDone = 0
$dbSaveMission6Started = 0
$dbSaveSlingingUnlocked = 0
$dbSaveSlingingRepBeach = 0
$dbSaveSlingDeals = 0
$dbSaveChemistUnlocked = 0
$dbSaveChemistDiscovered = 0
$dbSaveEcstasyDealerStage = 0
$dbSaveMayaUnlocked = 0
$dbSaveNightlifeUnlocked = 0
$dbSaveNightlifeRep = 0
$dbSaveGrowhouseOwned = 0
$dbSaveTyrellCrewSpawned = 0
$dbSaveWorkerSeeds = 0
$dbSaveWorkerHarvestReady = 0
$dbSaveWorkerHarvestGrams = 0
$dbSaveWorkerAkActive = 0
$dbSaveFarmOwned = 0
$dbSaveFarmCrewSpawned = 0
$dbSaveFarmAkSeeds = 0
$dbSaveFarmPoppySeeds = 0
$dbSaveFarmCocaSeeds = 0
$dbSaveFarmHarvestReady = 0
$dbSaveMorganFarmMoved = 0
$dbSaveMorganDeals = 0
$dbSaveMorganLsdReady = 0
$dbSaveEmpirePhaseUnlocked = 0
$dbSaveMexicanContactTalked = 0
$dbSaveCocaineBreakthroughDone = 0
$dbSaveMoney = 0
$dbSaveCurrentMoney = 0

$plant1X = 0.0
$plant1Y = 0.0
$plant1Z = 0.0
$plant2X = 0.0
$plant2Y = 0.0
$plant2Z = 0.0
$slingCustomerX = 0.0
$slingCustomerY = 0.0
$slingCustomerZ = 0.0
$poppyX = 0.0
$poppyY = 0.0
$poppyZ = 0.0
$cocaX = 0.0
$cocaY = 0.0
$cocaZ = 0.0

request_model #WMYCLOT
request_model #SBMYST

while not has_model_loaded #WMYCLOT
    wait 0
end

while not has_model_loaded #SBMYST
    wait 0
end

$supplier = create_char 4 #WMYCLOT at 2467.4016 -1753.9628 13.0
set_char_heading $supplier 180.0
wait 500
freeze_char_position $supplier True

$buyer = create_char 4 #SBMYST at 2306.9052 -1794.9338 13.5468
set_char_heading $buyer 92.0
wait 500
freeze_char_position $buyer True

mark_model_as_no_longer_needed #WMYCLOT
mark_model_as_no_longer_needed #SBMYST

// Supplier uses an invisible interaction radius; the red sphere caused repeated marker activation.
supplierMarker = -1
04CE: add_short_range_sprite_blip_for_coord 2467.4016 -1753.9628 13.0 sprite 52 store_to supplierBlip

0ACE: show_formatted_text_box "Grove Street is quiet, but money is thin."
wait 3000
0ACE: show_formatted_text_box "A supplier is waiting near Ryder's place."
wait 3000
print_string_now "DRUG BUSINESS v1.0.1~n~Release hotfix loaded" 6000
wait 2500
print_string_now "MISSION STARTED~n~Meet the supplier" 5000

while true
    wait 0
    01BD: nowTime = current_time_in_ms

    if
        $drugMenuUntil > nowTime
    then
        gosub @DRAW_DRUG_MENU_PROTOTYPE
        if
            is_key_just_pressed 49
        then
            $drugMenuPage = 1
            $drugMenuUntil = nowTime
            $drugMenuUntil += 8000
            wait 300
        end
        if
            is_key_just_pressed 50
        then
            $drugMenuPage = 2
            $drugMenuUntil = nowTime
            $drugMenuUntil += 8000
            wait 300
        end
        if
            is_key_just_pressed 51
        then
            $drugMenuPage = 3
            $drugMenuUntil = nowTime
            $drugMenuUntil += 8000
            wait 300
        end
        if
            is_key_just_pressed 52
        then
            $drugMenuPage = 4
            $drugMenuUntil = nowTime
            $drugMenuUntil += 8000
            wait 300
        end
        if
            is_key_just_pressed 78
        then
            $drugMenuUntil = 0
            print_string_now "Closed Black Market Menu" 2000
            wait 500
        end
    end

    if
        $weedIconUntil > nowTime
    then
        03F0: enable_text_draw 1
        038D: draw_texture 1 position 455.0 124.0 size 34.0 34.0 RGBA 255 255 255 255
        038D: draw_texture 2 position 500.0 124.0 size 34.0 34.0 RGBA 255 255 255 255
        038D: draw_texture 3 position 545.0 124.0 size 34.0 34.0 RGBA 255 255 255 255
        038D: draw_texture 4 position 590.0 124.0 size 34.0 34.0 RGBA 255 255 255 255
        038D: draw_texture 5 position 455.0 176.0 size 34.0 34.0 RGBA 255 255 255 255
        038D: draw_texture 6 position 500.0 176.0 size 34.0 34.0 RGBA 255 255 255 255
        038D: draw_texture 7 position 545.0 176.0 size 34.0 34.0 RGBA 255 255 255 255
        038D: draw_texture 8 position 590.0 176.0 size 34.0 34.0 RGBA 255 255 255 255
        033F: set_text_draw_letter_width_height 0.22 0.70
        0340: set_text_draw_RGBA 255 255 255 255
        0342: set_text_draw_centered 1
        0348: enable_text_draw_proportional 1
        045A: display_text_with_number 455.0 145.0 GXT 'NUMBER' number weedGrams
        033F: set_text_draw_letter_width_height 0.22 0.70
        0340: set_text_draw_RGBA 255 255 255 255
        0342: set_text_draw_centered 1
        0348: enable_text_draw_proportional 1
        045A: display_text_with_number 500.0 145.0 GXT 'NUMBER' number $akWeedGrams
        033F: set_text_draw_letter_width_height 0.22 0.70
        0340: set_text_draw_RGBA 255 255 255 255
        0342: set_text_draw_centered 1
        0348: enable_text_draw_proportional 1
        045A: display_text_with_number 545.0 145.0 GXT 'NUMBER' number $ecstasyPills
        033F: set_text_draw_letter_width_height 0.22 0.70
        0340: set_text_draw_RGBA 255 255 255 255
        0342: set_text_draw_centered 1
        0348: enable_text_draw_proportional 1
        045A: display_text_with_number 590.0 145.0 GXT 'NUMBER' number $opiumGrams
        033F: set_text_draw_letter_width_height 0.22 0.70
        0340: set_text_draw_RGBA 255 255 255 255
        0342: set_text_draw_centered 1
        0348: enable_text_draw_proportional 1
        045A: display_text_with_number 455.0 197.0 GXT 'NUMBER' number $heroinGrams
        033F: set_text_draw_letter_width_height 0.22 0.70
        0340: set_text_draw_RGBA 255 255 255 255
        0342: set_text_draw_centered 1
        0348: enable_text_draw_proportional 1
        045A: display_text_with_number 500.0 197.0 GXT 'NUMBER' number $mushroomPacks
        033F: set_text_draw_letter_width_height 0.22 0.70
        0340: set_text_draw_RGBA 255 255 255 255
        0342: set_text_draw_centered 1
        0348: enable_text_draw_proportional 1
        045A: display_text_with_number 545.0 197.0 GXT 'NUMBER' number $lsdTabs
        033F: set_text_draw_letter_width_height 0.22 0.70
        0340: set_text_draw_RGBA 255 255 255 255
        0342: set_text_draw_centered 1
        0348: enable_text_draw_proportional 1
        045A: display_text_with_number 590.0 197.0 GXT 'NUMBER' number $cocaineGrams
    end

    if
        is_key_just_pressed 120
    then
        if
            $weedIconLoaded == 0
        then
            0390: load_txd_dictionary 'DRUGSMENU'
            038F: 1 'weed'
            038F: 2 'ak47'
            038F: 3 'ecstasy'
            038F: 4 'opium'
            038F: 5 'heroin'
            038F: 6 'mushrooms'
            038F: 7 'lsd'
            038F: 8 'cocaine'
            $weedIconLoaded = 2
            print_string_now "DRUG ICONS LOADED~n~Press F9 again to draw" 4000
        else
            $weedIconUntil = nowTime
            $weedIconUntil += 8000
            print_string_now "DRAWING DRUG ICONS" 2000
        end
        wait 500
    end

    if
        is_key_just_pressed 117
    then
        $drugMenuPage += 1
        if
            $drugMenuPage > 4
        then
            $drugMenuPage = 1
        end
        $drugMenuUntil = nowTime
        $drugMenuUntil += 8000
        gosub @DRAW_DRUG_MENU_PROTOTYPE
        print_string_now "BLACK MARKET v1.0.1~n~F6 next, 1-4 pages, N close" 2000
    end

    if
        $ecstasyDealerDeals > 0
    then
        if
            $ecstasyDealerBlip == -1
        then
            04CE: add_short_range_sprite_blip_for_coord 408.0 -2052.0 8.0 sprite 52 store_to $ecstasyDealerBlip
        end
    end

    if
        $slingDeals > 4
    then
        if
            $ecstasyDealerSpawned == 0
        then
            gosub @SPAWN_ECSTASY_DEALER
        end
    end

    if
        00FE: locate_char_any_means_3d $scplayer coord 2459.4970 -1716.8455 13.5518 radius 2.0 2.0 2.0 sphere 0
    then
        if
            $dbSavePrompt == 0
        then
            print_help_string "Drug Business save spot: NUM7 save, NUM9 load"
            $dbSavePrompt = 1
        end
        if
            is_key_just_pressed 103
        then
            gosub @SAVE_DRUG_BUSINESS_PROGRESS
            wait 500
        end
        if
            is_key_just_pressed 105
        then
            gosub @LOAD_DRUG_BUSINESS_PROGRESS
            wait 500
        end
    else
        $dbSavePrompt = 0
    end

    activePlants = 0
    if
        $planted1 == 1
    then
        activePlants += 1
    end
    if
        $planted2 == 1
    then
        activePlants += 1
    end

    if
        buyerDiscovered == 0
    then
        if
            00FE: locate_char_any_means_3d $scplayer coord 2306.9052 -1794.9338 13.5468 radius 10.0 10.0 4.0 sphere 0
        then
            buyerDiscovered = 1
            03BC: add_sphere 2305.7 -1794.9 13.5468 radius 1.0 store_to buyerMarker
            04CE: add_short_range_sprite_blip_for_coord 2306.9052 -1794.9338 13.5468 sprite 52 store_to buyerBlip
            print_string_now "BUYER FOUND~n~Buyer marked on the map" 5000
        end
    end

    if
        $mission3Started == 1
    then
        if
            $hillGuardsSpawned == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2455.6840 -955.7086 80.762 radius 180.0 180.0 60.0 sphere 0
            then
                gosub @SPAWN_HILL_GUARDS
            end
        end

        if
            $hillPlantDone1 == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2445.8552 -950.2800 80.283 radius 3.0 3.0 3.0 sphere 0
            then
                if
                    $hillPrompt1 == 0
                then
                    print_help_string "Harvest AK-47. Press H"
                    $hillPrompt1 = 1
                end
                if
                    is_key_just_pressed 72
                then
                    gosub @HARVEST_HILL_1
                    wait 500
                end
            else
                $hillPrompt1 = 0
            end
        end

        if
            $hillPlantDone2 == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2443.3552 -950.2800 80.283 radius 3.0 3.0 3.0 sphere 0
            then
                if
                    $hillPrompt2 == 0
                then
                    print_help_string "Harvest AK-47. Press H"
                    $hillPrompt2 = 1
                end
                if
                    is_key_just_pressed 72
                then
                    gosub @HARVEST_HILL_2
                    wait 500
                end
            else
                $hillPrompt2 = 0
            end
        end

        if
            $hillPlantDone3 == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2448.3552 -950.2800 80.283 radius 3.0 3.0 3.0 sphere 0
            then
                if
                    $hillPrompt3 == 0
                then
                    print_help_string "Harvest AK-47. Press H"
                    $hillPrompt3 = 1
                end
                if
                    is_key_just_pressed 72
                then
                    gosub @HARVEST_HILL_3
                    wait 500
                end
            else
                $hillPrompt3 = 0
            end
        end

        if
            $hillPlantDone4 == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2445.8552 -953.2800 80.283 radius 3.0 3.0 3.0 sphere 0
            then
                if
                    $hillPrompt4 == 0
                then
                    print_help_string "Harvest AK-47. Press H"
                    $hillPrompt4 = 1
                end
                if
                    is_key_just_pressed 72
                then
                    gosub @HARVEST_HILL_4
                    wait 500
                end
            else
                $hillPrompt4 = 0
            end
        end

        if
            $mission3Harvested > 3
        then
            if
                $mission3PhoneDone == 0
            then
                $mission3PhoneDone = 1
                $mission4Started = 1
                $mission4AkHarvested = 0
                $mission4Complete = 0
                $akSeedPacks += 2
                print_string_now "MISSION PASSED~n~Hill Grow" 6000
                wait 3500
                print_string_now "MISSION IV~n~Harvest 2 AK-47 plants~n~Do not sell AK-47 yet" 7000
                wait 4000
                $drugHeat += 10
                gosub @CHECK_HEAT_PRESSURE
                print_string_now "PHONE CALL" 3000
                wait 2500
                0ACE: show_formatted_text_box "Unknown: You do not need to know me, but lay low."
                wait 3500
                0ACE: show_formatted_text_box "Unknown: Come to Palomino Creek if you want this heat handled."
                wait 4000
                print_string_now "CONTACT AVAILABLE~n~Enter Palomino Creek" 6000
                03BC: add_sphere 2450.5 -949.8 80.690 radius 1.2 store_to $growhouseMarker
            end
        end
    end

    if
        $growhouseMarker <> -1
    then
        if
            $growhouseOwned == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2450.5 -949.8 80.690 radius 1.5 1.5 2.0 sphere 0
            then
                if
                    $growhousePrompt == 0
                then
                    print_help_string "Press Y to buy growhouse for $500"
                    $growhousePrompt = 1
                end
                if
                    is_key_just_pressed 89
                then
                    if
                        010A: is_score_greater $player1 than 499
                    then
                        0109: add_score $player1 value -500
                        $growhouseOwned = 1
                        03BD: destroy_sphere $growhouseMarker
                        $growhouseMarker = -1
                        04CE: add_short_range_sprite_blip_for_coord 2450.5 -949.8 80.690 sprite 52 store_to $growhouseBlip
                        print_string_now "GROWHOUSE PURCHASED" 5000
                        wait 3000
                        if
                            $growhouseTyrellCallDone == 0
                        then
                            gosub @GROWHOUSE_TYRELL_CALL
                        end
                    else
                        print_string_now "Not enough money" 3000
                    end
                    wait 500
                end
            else
                $growhousePrompt = 0
            end
        end
    end

    if
        $mission3PhoneDone == 1
    then
        if
            $mission3ContactSpawned == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2268.0 -75.0 26.5 radius 120.0 120.0 30.0 sphere 0
            then
                $mission3ContactSpawned = 1
                request_model #DSHER
                while not has_model_loaded #DSHER
                    wait 0
                end
                $palominoContact = create_char 4 #DSHER at 2257.0 -83.0 26.5
                set_char_heading $palominoContact 90.0
                wait 500
                freeze_char_position $palominoContact True
                mark_model_as_no_longer_needed #DSHER
                04CE: add_short_range_sprite_blip_for_coord 2257.0 -83.0 26.5 sprite 37 store_to $palominoContactBlip
                03BC: add_sphere 2255.8 -83.0 26.5 radius 1.2 store_to $palominoContactMarker
                print_string_now "CONTACT FOUND~n~Question mark added to the map" 6000
            end
        end
    end

    if
        $mission3ContactSpawned == 1
    then
        if
            00FE: locate_char_any_means_3d $scplayer coord 2255.8 -83.0 26.5 radius 1.5 1.5 2.0 sphere 0
        then
            if
                $palominoContactTalked == 0
            then
                if
                    $palominoPrompt == 0
                then
                    print_help_string "Press T to talk"
                    $palominoPrompt = 1
                end
                if
                    is_key_just_pressed 84
                then
                    gosub @PALOMINO_CONTACT_TALK
                    wait 500
                end
            else
                if
                    $palominoPrompt == 0
                then
                    print_help_string "1 small bribe, 2 medium bribe, 3 large bribe"
                    $palominoPrompt = 1
                end
                if
                    is_key_just_pressed 49
                then
                    gosub @BRIBE_SMALL
                    wait 500
                end
                if
                    is_key_just_pressed 50
                then
                    gosub @BRIBE_MEDIUM
                    wait 500
                end
                if
                    is_key_just_pressed 51
                then
                    gosub @BRIBE_LARGE
                    wait 500
                end
            end
        else
            $palominoPrompt = 0
        end
    end

    if
        $mission5Started == 1
    then
        if
            $isaacSpawned == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 370.0 -2046.0 8.2 radius 90.0 90.0 25.0 sphere 0
            then
                request_model 14
                while not has_model_loaded 14
                    wait 0
                end
                $isaac = create_char 4 14 at 370.0 -2046.0 8.6
                set_char_heading $isaac 120.0
                wait 500
                freeze_char_position $isaac True
                mark_model_as_no_longer_needed 14
                $isaacSpawned = 1
            end
        end

        if
            $isaacDiscovered == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 370.0 -2046.0 8.6 radius 35.0 35.0 10.0 sphere 0
            then
                $isaacDiscovered = 1
                04CE: add_short_range_sprite_blip_for_coord 370.0 -2046.0 8.6 sprite 52 store_to $isaacBlip
                03BC: add_sphere 368.8 -2045.2 8.6 radius 1.2 store_to $isaacMarker
                print_string_now "ISAAC FOUND~n~Dollar marker added" 5000
            end
        end

        if
            $isaacDiscovered == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 368.8 -2045.2 8.6 radius 1.5 1.5 2.0 sphere 0
            then
                if
                    $isaacPrompt == 0
                then
                    print_help_string "Press T to talk"
                    $isaacPrompt = 1
                end
                if
                    is_key_just_pressed 84
                then
                    if
                        $mission6Started == 0
                    then
                        gosub @START_MISSION_VI
                    else
                        if
                            $slingingUnlocked == 1
                        then
                            $slingingUnlocked = 0
                            if
                                $beachCrowdSpawned == 1
                            then
                                gosub @CLEAR_BEACH_CROWD
                            end
                            print_string_now "SLINGING PAUSED" 3000
                            wait 1500
                            0ACE: show_formatted_text_box "Isaac: Alright, I will stop sending beach customers your way."
                            wait 3000
                        else
                            $slingingUnlocked = 1
                            $slingNextSpawn = nowTime
                            $slingNextSpawn += 10000
                            print_string_now "Slinging - Santa Maria Beach" 4000
                            wait 1500
                            0ACE: show_formatted_text_box "Isaac: I will put word out. Watch for marked customers on the beach."
                            wait 3500
                        end
                    end
                    wait 500
                end
            else
                $isaacPrompt = 0
            end
        end
    end

    if
        $slingingUnlocked == 1
    then
        if
            $mission5Started == 1
        then
            if
                $mission6Started == 0
            then
                gosub @ENSURE_MISSION_VI_ACTIVE
            end
        end
        if
            00FE: locate_char_any_means_3d $scplayer coord 370.0 -2046.0 8.2 radius 520.0 520.0 60.0 sphere 0
        then
            if
                $beachCrowdSpawned == 0
            then
                gosub @SPAWN_BEACH_CROWD
            end

            if
                $slingCustomerActive == 0
            then
                if
                    $mayaIntroSpawned <> 1
                then
                    elapsed = nowTime
                    elapsed -= $slingNextSpawn
                    if
                        elapsed > 0
                    then
                        if
                            $drugHeat > 99
                        then
                            elapsed = nowTime
                            elapsed -= heatCooldown
                            if
                                elapsed > 0
                            then
                                print_string_now "HEAT CRITICAL~n~Customers are laying low" 5000
                                heatCooldown = nowTime
                                heatCooldown += 20000
                            end
                        else
                            gosub @SPAWN_SLING_CUSTOMER
                        end
                    end
                end
            end

            if
                $slingCustomerActive == 1
            then
                if
                    0118: actor $slingCustomer dead
                then
                    gosub @CLEAR_DEAD_SLING_CUSTOMER
                else
                    if
                        00FE: locate_char_any_means_3d $scplayer coord $slingCustomerX $slingCustomerY $slingCustomerZ radius 5.0 5.0 4.0 sphere 0
                    then
                        if
                            $slingCustomerPrompt == 0
                        then
                            print_help_string "Press T to talk"
                            $slingCustomerPrompt = 1
                        end
                        if
                            is_key_just_pressed 84
                        then
                            $mayaMenu = 0
                            $nightCustomerMenu = 0
                            $farmWorkerMenu = 0
                            $morganMenu = 0
                            sellMenu = 0
                            $slingCustomerMenu = 1
                            if
                                $cocaineBreakthroughDone == 1
                            then
                                0AD1: show_formatted_text_highpriority "CUSTOMER~n~1 AK1  2 AK5  3 AK20~n~4 XTC 5 Heroin 6 Opium 7 Coke~n~N close" time 7000
                            else
                                if
                                    $chemistUnlocked == 1
                                then
                                    0AD1: show_formatted_text_highpriority "CUSTOMER~n~1 AK1  2 AK5  3 AK20~n~4 XTC 5 Heroin 6 Opium~n~N close" time 7000
                                else
                                    if
                                        $ecstasyDealerDeals > 0
                                    then
                                        0AD1: show_formatted_text_highpriority "CUSTOMER~n~1 AK1  2 AK5  3 AK20~n~4 Ecstasy~n~N close" time 7000
                                    else
                                        0AD1: show_formatted_text_highpriority "CUSTOMER~n~1 AK-47 1g~n~2 AK-47 5g~n~3 AK-47 20g~n~N close" time 7000
                                    end
                                end
                            end
                            wait 500
                        end
                    else
                        $slingCustomerPrompt = 0
                        $slingCustomerMenu = 0
                    end
                end
            end
        end
    end

    if
        $mission5Started == 1
    then
        if
            $ecstasyDealerDeals > 0
        then
            if
                $ecstasyDealerBlip == -1
            then
                04CE: add_short_range_sprite_blip_for_coord 408.0 -2052.0 8.0 sprite 52 store_to $ecstasyDealerBlip
            end
        end
        if
            $slingDeals > 4
        then
            if
                $ecstasyDealerSpawned == 0
            then
                gosub @SPAWN_ECSTASY_DEALER
            end
        end
    end

        if
            $mission8Complete == 1
        then
            if
                $mayaUnlocked == 0
            then
                if
                    $mayaObjectiveStarted == 0
                then
                    $mayaObjectiveStarted = 1
                    print_string_now "PHONE CALL~n~Isaac" 4000
                    wait 2500
                    0ACE: show_formatted_text_box "Isaac: CJ, a special customer is asking about you at the beach."
                    wait 4500
                    0ACE: show_formatted_text_box "Isaac: She is not regular beach traffic. Bring something unusual if you got it."
                    wait 4500
                    print_string_now "PHONE CALL~n~Maya" 4000
                    wait 2500
                    0ACE: show_formatted_text_box "Maya: Isaac says you found something unusual."
                    wait 4500
                    0ACE: show_formatted_text_box "CJ: I got a tab of LSD from those Vagos at Hilltop."
                    wait 5000
                    0ACE: show_formatted_text_box "CJ: If you know that crowd, maybe we should talk business."
                    wait 5000
                    0ACE: show_formatted_text_box "Maya: LSD means you are not just beach traffic anymore."
                    wait 4500
                    0ACE: show_formatted_text_box "Maya: I move with night people. Club people. Find me near Market."
                    wait 5000
                    if
                        $lsdTabs == 0
                    then
                        $lsdTabs += 1
                    end
                    $mayaUnlocked = 1
                    $nightlifeSlingingUnlocked = 1
                    $mayaIntroSpawned = 2
                    $mayaObjectiveStarted = 2
                    if
                        $mayaBlip <> -1
                    then
                        0164: remove_blip $mayaBlip
                        $mayaBlip = -1
                    end
                    if
                        $mayaMarker <> -1
                    then
                        03BD: destroy_sphere $mayaMarker
                        $mayaMarker = -1
                    end
                    04CE: add_short_range_sprite_blip_for_coord 1095.0 -1185.0 18.0 sprite 52 store_to $mayaBlip
                    print_string_now "MAYA UNLOCKED~n~Dollar marker near Market" 6000
                end
            end
        end

        if
            $mayaIntroSpawned == 1
        then
            if
                $mayaIntroActorSpawned == 0
            then
                gosub @SPAWN_MAYA_INTRO
            end
            if
                $mayaIntroActorSpawned == 1
            then
                if
                    0118: actor $maya dead
                then
                    $mayaIntroActorSpawned = 0
                    gosub @SPAWN_MAYA_INTRO
                end
            end
            if
                00FE: locate_char_any_means_3d $scplayer coord 258.5 -1808.5 3.2 radius 1.8 1.8 2.0 sphere 0
            then
                if
                    $mayaPrompt == 0
                then
                    print_help_string "Press T to talk to Maya"
                    $mayaPrompt = 1
                end
                if
                    is_key_just_pressed 84
                then
                    gosub @MAYA_INTRO_TALK
                    wait 500
                end
            else
                $mayaPrompt = 0
            end
        end

        if
            $mayaUnlocked == 1
        then
            if
                $mayaIntroSpawned == 2
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 1095.0 -1185.0 18.0 radius 100.0 100.0 40.0 sphere 0
                then
                    gosub @SPAWN_MAYA_PERMANENT
                end
            end
            if
                $mayaIntroSpawned == 3
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 1093.8 -1185.0 18.0 radius 1.8 1.8 2.0 sphere 0
                then
                    if
                        $mayaPrompt == 0
                    then
                        print_help_string "Press T to talk to Maya"
                        $mayaPrompt = 1
                    end
                    if
                        is_key_just_pressed 84
                    then
                        $slingCustomerMenu = 0
                        $nightCustomerMenu = 0
                        $farmWorkerMenu = 0
                        $morganMenu = 0
                        sellMenu = 0
                        $mayaMenu = 1
                        if
                            $mexicanContactTalked == 1
                        then
                            0AD1: show_formatted_text_highpriority "MAYA~n~1 XTC $60  2 LSD $60~n~3 Mushrooms $45~n~4 Nightlife  5 Sell coke~n~N close" time 7000
                        else
                            0AD1: show_formatted_text_highpriority "MAYA~n~1 XTC $60  2 LSD $60~n~3 Mushrooms $45~n~4 Toggle nightlife~n~N close" time 7000
                        end
                        wait 500
                    end
                else
                    $mayaPrompt = 0
                    $mayaMenu = 0
                end
            end
        end

        if
            $mayaMenu == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 1093.8 -1185.0 18.0 radius 3.0 3.0 3.0 sphere 0
            then
                if
                    is_key_just_pressed 49
                then
                    gosub @MAYA_BUY_ECSTASY
                    wait 500
                end
                if
                    is_key_just_pressed 50
                then
                    gosub @MAYA_BUY_LSD
                    wait 500
                end
                if
                    is_key_just_pressed 51
                then
                    gosub @MAYA_BUY_MUSHROOMS
                    wait 500
                end
                if
                    is_key_just_pressed 52
                then
                    gosub @MAYA_TOGGLE_NIGHTLIFE
                    wait 500
                end
                if
                    is_key_just_pressed 53
                then
                    if
                        $cocaineBreakthroughDone == 1
                    then
                        gosub @MAYA_SELL_COCAINE
                    else
                        print_string_now "Maya is not buying that yet" 3000
                    end
                    wait 500
                end
                if
                    is_key_just_pressed 78
                then
                    $mayaMenu = 0
                    print_string_now "Closed Maya menu" 2000
                    wait 500
                end
            else
                $mayaMenu = 0
            end
        end

        if
            $nightlifeActive == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 1095.0 -1185.0 18.0 radius 180.0 180.0 40.0 sphere 0
            then
                if
                    $nightCustomerActive == 0
                then
                    elapsed = nowTime
                    elapsed -= $nightNextSpawn
                    if
                        elapsed > 0
                    then
                        if
                            $drugHeat > 99
                        then
                            elapsed = nowTime
                            elapsed -= heatCooldown
                            if
                                elapsed > 0
                            then
                                print_string_now "HEAT CRITICAL~n~Nightlife customers are laying low" 5000
                                heatCooldown = nowTime
                                heatCooldown += 20000
                            end
                        else
                            gosub @SPAWN_NIGHT_CUSTOMER
                        end
                    end
                end
                if
                    $nightCustomerActive == 1
                then
                    if
                        0118: actor $nightCustomer dead
                    then
                        gosub @CLEAR_DEAD_NIGHT_CUSTOMER
                    else
                        if
                            00FE: locate_char_any_means_3d $scplayer coord $slingCustomerX $slingCustomerY $slingCustomerZ radius 4.0 4.0 3.0 sphere 0
                        then
                            if
                                $nightCustomerPrompt == 0
                            then
                                print_help_string "Press T to talk"
                                $nightCustomerPrompt = 1
                            end
                            if
                                is_key_just_pressed 84
                            then
                                $mayaMenu = 0
                                $slingCustomerMenu = 0
                                $farmWorkerMenu = 0
                                $morganMenu = 0
                                sellMenu = 0
                                $nightCustomerMenu = 1
                                if
                                    $cocaineBreakthroughDone == 1
                                then
                                    0AD1: show_formatted_text_highpriority "NIGHT CUSTOMER~n~1 Ecstasy  2 LSD~n~3 Mushrooms  4 Coke~n~N close" time 7000
                                else
                                    0AD1: show_formatted_text_highpriority "NIGHT CUSTOMER~n~1 Ecstasy  2 LSD~n~3 Mushrooms~n~N close" time 7000
                                end
                                wait 500
                            end
                        else
                            $nightCustomerPrompt = 0
                            $nightCustomerMenu = 0
                        end
                    end
                end
            else
                $nightCustomerMenu = 0
                $nightCustomerPrompt = 0
            end
        end

    if
        $nightCustomerMenu == 1
    then
        if
            00FE: locate_char_any_means_3d $scplayer coord $slingCustomerX $slingCustomerY $slingCustomerZ radius 5.0 5.0 4.0 sphere 0
        then
            if
                is_key_just_pressed 49
            then
                gosub @NIGHT_SELL_ECSTASY
                wait 500
            end
            if
                is_key_just_pressed 50
            then
                gosub @NIGHT_SELL_LSD
                wait 500
            end
            if
                is_key_just_pressed 51
            then
                gosub @NIGHT_SELL_MUSHROOMS
                wait 500
            end
            if
                is_key_just_pressed 52
            then
                if
                    $cocaineBreakthroughDone == 1
                then
                    gosub @NIGHT_SELL_COCAINE
                else
                    print_string_now "Customer is not asking for that yet" 3000
                end
                wait 500
            end
            if
                is_key_just_pressed 78
            then
                $nightCustomerMenu = 0
                print_string_now "Closed customer menu" 2000
                wait 500
        end
        else
            $nightCustomerMenu = 0
        end
    end

        if
            $smuggleActive == 1
        then
            if
                $smuggleRoute == 1
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 1097.2 -1185.0 18.0 radius 2.5 2.5 3.0 sphere 0
                then
                    if
                        $smugglePrompt == 0
                    then
                        print_help_string "Press Y to unload shipment"
                        $smugglePrompt = 1
                    end
                    if
                        is_key_just_pressed 89
                    then
                        gosub @FINISH_HEROIN_SMUGGLE
                        wait 800
                    end
                else
                    $smugglePrompt = 0
                end
            else
                if
                    $smuggleRoute == 2
                then
                    if
                        $smuggleStage == 1
                    then
                        if
                            00FE: locate_char_any_means_3d $scplayer coord 2450.5 -949.8 80.690 radius 3.0 3.0 3.0 sphere 0
                        then
                            if
                                $smugglePrompt == 0
                            then
                                print_help_string "Press Y to load growhouse weed"
                                $smugglePrompt = 1
                            end
                            if
                                is_key_just_pressed 89
                            then
                                gosub @EMPIRE_PICKUP_GROWHOUSE
                                wait 800
                            end
                        else
                            $smugglePrompt = 0
                        end
                    else
                        if
                            $smuggleStage == 2
                        then
                            if
                                00FE: locate_char_any_means_3d $scplayer coord 1097.2 -1185.0 18.0 radius 2.5 2.5 3.0 sphere 0
                            then
                                if
                                    $smugglePrompt == 0
                                then
                                    print_help_string "Press Y to unload at Maya"
                                    $smugglePrompt = 1
                                end
                                if
                                    is_key_just_pressed 89
                                then
                                    gosub @EMPIRE_DELIVER_MAYA
                                    wait 800
                                end
                            else
                                $smugglePrompt = 0
                            end
                        else
                            if
                                $smuggleStage == 3
                            then
                                if
                                    00FE: locate_char_any_means_3d $scplayer coord 368.8 -2045.2 8.6 radius 3.0 3.0 3.0 sphere 0
                                then
                                    if
                                        $smugglePrompt == 0
                                    then
                                        print_help_string "Press Y to finish empire route"
                                        $smugglePrompt = 1
                                    end
                                    if
                                        is_key_just_pressed 89
                                    then
                                        gosub @FINISH_EMPIRE_SMUGGLE
                                        wait 800
                                    end
                                else
                                    $smugglePrompt = 0
                                end
                            end
                        end
                    end
                end
            end
        end

        if
            $ecstasyDealerSpawned == 1
        then
            if
                $ecstasyDealerBlip == -1
            then
                04CE: add_short_range_sprite_blip_for_coord 408.0 -2052.0 8.0 sprite 52 store_to $ecstasyDealerBlip
            end
            if
                00FE: locate_char_any_means_3d $scplayer coord 408.0 -2052.0 8.0 radius 1.8 1.8 2.0 sphere 0
            then
                if
                    $ecstasyDealerPrompt == 0
                then
                    print_help_string "Press T to talk"
                    $ecstasyDealerPrompt = 1
                end
                if
                    is_key_just_pressed 84
                then
                    $ecstasyDealerMenu = 1
                    if
                        $cocaineBreakthroughDone == 1
                    then
                        0AD1: show_formatted_text_highpriority "DEALER~n~1 Buy ecstasy~n~2 Sell 5g cocaine~n~N close" time 7000
                    else
                        0AD1: show_formatted_text_highpriority "DEALER~n~1 Buy ecstasy~n~N close" time 7000
                    end
                    wait 500
                end
            else
                $ecstasyDealerPrompt = 0
                $ecstasyDealerMenu = 0
            end
        end

        if
            $ecstasyDealerMenu == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 408.0 -2052.0 8.0 radius 3.0 3.0 3.0 sphere 0
            then
                if
                    is_key_just_pressed 49
                then
                    gosub @BUY_ECSTASY
                    wait 500
                end
                if
                    is_key_just_pressed 50
                then
                    if
                        $cocaineBreakthroughDone == 1
                    then
                        gosub @DEALER_SELL_COCAINE
                    else
                        print_string_now "Dealer is not buying that yet" 3000
                    end
                    wait 500
                end
                if
                    is_key_just_pressed 78
                then
                    $ecstasyDealerMenu = 0
                    print_string_now "Closed dealer menu" 2000
                    wait 500
                end
            else
                $ecstasyDealerMenu = 0
            end
        end

    if
        $mission6Started == 2
    then
        if
            $mission7Started == 0
        then
            gosub @START_MISSION_VII
        end
    end

    if
        $slingCustomerMenu == 1
    then
        if
            00FE: locate_char_any_means_3d $scplayer coord $slingCustomerX $slingCustomerY $slingCustomerZ radius 6.0 6.0 5.0 sphere 0
        then
            if
                is_key_just_pressed 49
            then
                gosub @SLING_SELL_1
                wait 500
            end
            if
                is_key_just_pressed 50
            then
                gosub @SLING_SELL_5
                wait 500
            end
            if
                is_key_just_pressed 51
            then
                gosub @SLING_SELL_20
                wait 500
            end
            if
                is_key_just_pressed 52
            then
                gosub @SLING_SELL_ECSTASY
                wait 500
            end
            if
                is_key_just_pressed 53
            then
                gosub @SLING_SELL_HEROIN
                wait 500
            end
            if
                is_key_just_pressed 54
            then
                gosub @SLING_SELL_OPIUM
                wait 500
            end
            if
                is_key_just_pressed 55
            then
                gosub @SLING_SELL_COCAINE
                wait 500
            end
            if
                is_key_just_pressed 78
            then
                $slingCustomerMenu = 0
                print_string_now "Closed customer menu" 2000
                wait 500
            end
        else
            $slingCustomerMenu = 0
        end
    end

if
    $growhouseTyrellCallDone == 1
then
    if
        $tyrellCrewSpawned == 0
    then
        if
            00FE: locate_char_any_means_3d $scplayer coord 2456.07 -951.6974 80.768 radius 80.0 80.0 40.0 sphere 0
        then
            gosub @SPAWN_TYRELL_CREW
        end
    end

    if
        $growhouseSecurityBought == 1
    then
        if
            $growhouseSecuritySpawned == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2450.5 -949.8 80.690 radius 120.0 120.0 40.0 sphere 0
            then
                gosub @SPAWN_GROWHOUSE_SECURITY
            end
        end
    end

    if
        $tyrellCrewSpawned == 0
    then
            elapsed = nowTime
            elapsed -= $tyrellCallTime
            if
                elapsed > 60000
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 2456.07 -951.6974 80.768 radius 120.0 120.0 40.0 sphere 0
                then
                    gosub @SPAWN_TYRELL_CREW
                end
            end
        end

        if
            $tyrellCrewSpawned == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2456.07 -951.6974 80.768 radius 1.8 1.8 2.0 sphere 0
            then
                if
                    $tyrellPrompt == 0
                then
                    print_help_string "Press T to talk to Tyrell"
                    $tyrellPrompt = 1
                end
                if
                    is_key_just_pressed 84
                then
                    freeze_char_position $tyrell False
                    freeze_char_position $groveWorker False
                    wait 800
                    freeze_char_position $tyrell True
                    freeze_char_position $groveWorker True
                    $tyrellMenu = 1
                    0AD1: show_formatted_text_highpriority "TYRELL~n~1 Give seed~n~2 Collect~n~3 Guard $2500~n~N close" time 7000
                    wait 500
                end
            else
                $tyrellPrompt = 0
            end
        end
    end

    if
        $tyrellMenu == 1
    then
        if
            is_key_just_pressed 49
        then
            gosub @TYRELL_GIVE_SEED
            wait 500
        end
        if
            is_key_just_pressed 50
        then
            gosub @TYRELL_COLLECT
            wait 500
        end
        if
            is_key_just_pressed 51
        then
            gosub @BUY_GROWHOUSE_SECURITY
            wait 500
        end
        if
            is_key_just_pressed 78
        then
            $tyrellMenu = 0
            print_string_now "Closed Tyrell menu" 2000
            wait 500
        end
    end

    if
        $chemistUnlocked == 1
    then
        if
            $morganFarmMoved == 0
        then
            if
                $chemistCallDone == 1
            then
            if
                $chemistQuestionBlip == -1
            then
                04CE: add_short_range_sprite_blip_for_coord 475.1535 -1143.6329 68.5578 sprite 37 store_to $chemistQuestionBlip
            end

            if
                $chemistSpawned == 0
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 475.1535 -1143.6329 68.5578 radius 100.0 100.0 30.0 sphere 0
                then
                    gosub @SPAWN_CHEMIST
                end
            end

            if
                $chemistDiscovered == 0
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 475.1535 -1143.6329 68.5578 radius 30.0 30.0 10.0 sphere 0
                then
                    $chemistDiscovered = 1
                    03BC: add_sphere 473.8 -1143.4 68.5578 radius 1.2 store_to $chemistMarker
                    print_string_now "CHEMIST FOUND~n~Talk to Morgan" 5000
                end
            end

            if
                $chemistDiscovered == 1
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 473.8 -1143.4 68.5578 radius 1.8 1.8 2.0 sphere 0
                then
                    if
                        $chemistPrompt == 0
                    then
                        print_help_string "Press T to talk to chemist"
                        $chemistPrompt = 1
                    end
                    if
                        is_key_just_pressed 84
                    then
                        gosub @CHEMIST_TALK
                        wait 500
                    end
                else
                    $chemistPrompt = 0
                end
            end
        end
    end
    end

    if
        $morganFarmMoved == 1
    then
        if
            00FE: locate_char_any_means_3d $scplayer coord 1037.8 -326.0 73.9850 radius 1.8 1.8 2.0 sphere 0
        then
            if
                $chemistPrompt == 0
            then
                print_help_string "Press T to talk to Morgan"
                $chemistPrompt = 1
            end
            if
                is_key_just_pressed 84
            then
                $mayaMenu = 0
                $slingCustomerMenu = 0
                $nightCustomerMenu = 0
                $farmWorkerMenu = 0
                sellMenu = 0
                $morganMenu = 1
                0AD1: show_formatted_text_highpriority "MORGAN LAB~n~1 Process opium~n~2 Buy 1 LSD $60~n~3 Collect LSD~n~4 Refine coca~n~N close" time 7000
                wait 500
            end
        else
            $chemistPrompt = 0
            $morganMenu = 0
        end
    end

    if
        $morganMenu == 1
    then
        if
            00FE: locate_char_any_means_3d $scplayer coord 1037.8 -326.0 73.9850 radius 3.0 3.0 3.0 sphere 0
        then
            if
                is_key_just_pressed 49
            then
                gosub @MORGAN_PROCESS_OPIUM
                wait 500
            end
            if
                is_key_just_pressed 50
            then
                gosub @MORGAN_BUY_LSD
                wait 500
            end
            if
                is_key_just_pressed 51
            then
                gosub @MORGAN_COLLECT_LSD
                wait 500
            end
            if
                is_key_just_pressed 52
            then
                gosub @MORGAN_REFINE_COCA
                wait 500
            end
            if
                is_key_just_pressed 78
            then
                $morganMenu = 0
                print_string_now "Closed Morgan menu" 2000
                wait 500
            end
        else
            $morganMenu = 0
        end
    end

    if
        $mission8Unlocked == 1
    then
        if
            $mission8Started == 0
        then
            gosub @START_MISSION_VIII
        end
    end

    if
        $mission8Started == 1
    then
        if
            $mission8Complete == 0
        then
            if
                $farmGuardsSpawned == 0
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 1044.4471 -332.1785 73.9850 radius 120.0 120.0 60.0 sphere 0
                then
                    gosub @SPAWN_FARM_GUARDS
                end
            end

            if
                $farmGuardsSpawned == 1
            then
                if
                    $farmMarker == -1
                then
                    if
                        0118: actor $farmGuard1 dead
                    then
                        if
                            0118: actor $farmGuard2 dead
                        then
                            if
                                0118: actor $farmGuard3 dead
                            then
                                03BC: add_sphere 1044.4471 -332.1785 73.9850 radius 1.5 store_to $farmMarker
                                print_string_now "FARM CLEAR~n~Buy marker available" 5000
                            end
                        end
                    end
                end
            end

            if
                $farmMarker <> -1
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 1044.4471 -332.1785 73.9850 radius 2.0 2.0 2.0 sphere 0
                then
                    if
                        $farmPrompt == 0
                    then
                        print_help_string "Press Y to buy Hilltop Farm for $1000"
                        $farmPrompt = 1
                    end
                    if
                        is_key_just_pressed 89
                    then
                        gosub @BUY_RED_COUNTY_FARM
                        wait 500
                    end
                else
                    $farmPrompt = 0
                end
            end
        end
    end

    if
        $farmOwned == 1
    then
        if
            $farmCrewSpawned == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 1044.4471 -332.1785 73.9850 radius 140.0 140.0 60.0 sphere 0
            then
                gosub @SPAWN_FARM_CREW
            end
        end

        if
            $farmCrewSpawned == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 1041.8 -329.2 73.9850 radius 2.0 2.0 2.0 sphere 0
            then
                if
                    $farmWorkerPrompt == 0
                then
                    print_help_string "Press T to talk to Hilltop crew"
                    $farmWorkerPrompt = 1
                end
                if
                    is_key_just_pressed 84
                then
                    freeze_char_position $farmWorker1 False
                    freeze_char_position $farmWorker2 False
                    wait 800
                    freeze_char_position $farmWorker1 True
                    freeze_char_position $farmWorker2 True
                    $mayaMenu = 0
                    $slingCustomerMenu = 0
                    $nightCustomerMenu = 0
                    $morganMenu = 0
                    sellMenu = 0
                    $farmWorkerMenu = 1
                    if
                        $mayaUnlocked == 1
                    then
                        if
                            $mexicanContactTalked == 1
                        then
                            0AD1: show_formatted_text_highpriority "HILLTOP FARM~n~1 AK 2 Poppy 3 Coca~n~4 Collect 5 Morgan~n~6 Maya route 7 Empire~n~N close" time 7000
                        else
                            0AD1: show_formatted_text_highpriority "HILLTOP FARM~n~1 AK 2 Poppy~n~4 Collect 5 Morgan~n~6 Maya route 7 Empire~n~N close" time 7000
                        end
                    else
                        if
                            $mexicanContactTalked == 1
                        then
                            0AD1: show_formatted_text_highpriority "HILLTOP FARM~n~1 AK 2 Poppy 3 Coca~n~4 Collect 5 Morgan~n~N close" time 7000
                        else
                            0AD1: show_formatted_text_highpriority "HILLTOP FARM~n~1 AK 2 Poppy~n~4 Collect 5 Morgan~n~N close" time 7000
                        end
                    end
                    wait 500
                end
            else
                $farmWorkerPrompt = 0
                $farmWorkerMenu = 0
            end
        end
    end

    if
        $farmWorkerMenu == 1
    then
        if
            00FE: locate_char_any_means_3d $scplayer coord 1041.8 -329.2 73.9850 radius 3.0 3.0 3.0 sphere 0
        then
            if
                is_key_just_pressed 49
            then
                gosub @FARM_GIVE_AK_SEED
                wait 500
            end
            if
                is_key_just_pressed 50
            then
                gosub @FARM_GIVE_POPPY_SEED
                wait 500
            end
            if
                is_key_just_pressed 51
            then
                if
                    $mexicanContactTalked == 1
                then
                    gosub @FARM_GIVE_COCA_SEED
                else
                    print_string_now "Coca rows locked" 3000
                end
                wait 500
            end
            if
                is_key_just_pressed 52
            then
                gosub @FARM_COLLECT
                wait 500
            end
            if
                is_key_just_pressed 53
            then
                gosub @BUY_MORGAN_FARM_UPGRADE
                wait 500
            end
            if
                is_key_just_pressed 54
            then
                if
                    $mayaUnlocked == 1
                then
                    gosub @START_HEROIN_SMUGGLE
                else
                    print_string_now "Maya route locked" 3000
                end
                wait 500
            end
            if
                is_key_just_pressed 55
            then
                if
                    $mayaUnlocked == 1
                then
                    gosub @START_EMPIRE_SMUGGLE
                else
                    print_string_now "Empire route locked" 3000
                end
                wait 500
            end
            if
                is_key_just_pressed 78
            then
                $farmWorkerMenu = 0
                print_string_now "Closed farm menu" 2000
                wait 500
            end
        else
            $farmWorkerMenu = 0
        end
    end

    if
        $mexicanContactSpawned == 1
    then
        if
            $mexicanContactTalked == 0
        then
            if
                $mexicanContactActorSpawned == 0
            then
                if
                    00FE: locate_char_any_means_3d $scplayer coord 1692.0 -1955.0 13.5 radius 120.0 120.0 40.0 sphere 0
                then
                    gosub @SPAWN_MEXICAN_CONTACT_ACTOR
                end
            end
            if
                00FE: locate_char_any_means_3d $scplayer coord 1692.0 -1955.0 13.5 radius 2.0 2.0 2.0 sphere 0
            then
                if
                    $mexicanPrompt == 0
                then
                    print_help_string "Press T to talk"
                    $mexicanPrompt = 1
                end
                if
                    is_key_just_pressed 84
                then
                    gosub @MEXICAN_CONTACT_TALK
                    wait 500
                end
            else
                $mexicanPrompt = 0
            end
        end
    end

    if
        0AB0: key_pressed 9
    then
        if
            is_key_just_pressed 79
        then
            gosub @PLANT_POPPY
            wait 500
        end
        if
            is_key_just_pressed 75
        then
            gosub @PLANT_COCA
            wait 500
        end
    end

    if
        $poppyPlanted == 1
    then
        elapsed = nowTime
        elapsed -= $poppyStart
        if
            elapsed > 30000
        then
            if
                $poppyStage == 1
            then
                08D2: set_object_scale $poppyPlant to 0.25
                $poppyStage = 2
            end
        end
        if
            elapsed > 60000
        then
            if
                $poppyStage == 2
            then
                08D2: set_object_scale $poppyPlant to 0.40
                $poppyReady = 1
                $poppyStage = 3
                0188: add_blip_for_object $poppyPlant store_to $poppyBlip
                0165: change_blip_colour $poppyBlip to 3
                018B: change_blip_display $poppyBlip to 3
                print_string_now "Poppy ready to harvest" 3000
            end
        end
        if
            $poppyReady == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord $poppyX $poppyY $poppyZ radius 2.0 2.0 2.0 sphere 0
            then
                if
                    $poppyPrompt == 0
                then
                    print_help_string "Harvest poppy. Press H"
                    $poppyPrompt = 1
                end
                if
                    is_key_just_pressed 72
                then
                    gosub @HARVEST_POPPY
                    wait 500
                end
            else
                $poppyPrompt = 0
            end
        end
    end

    if
        $cocaPlanted == 1
    then
        01BD: nowTime = current_time_in_ms
        if
            $cocaStart == 0
        then
            $cocaStart = nowTime
            $cocaStart += 1
        end
        elapsed = nowTime
        elapsed -= $cocaStart
        if
            elapsed < 0
        then
            $cocaStart = nowTime
            elapsed = 0
        end
        $cocaGrowTicks += 1
        if
            elapsed > 40000
        then
            if
                $cocaStage == 1
            then
                gosub @COCA_ADVANCE_STAGE_2
            end
        end
        if
            $cocaGrowTicks > 2400
        then
            if
                $cocaStage == 1
            then
                gosub @COCA_ADVANCE_STAGE_2
            end
        end
        if
            elapsed > 60000
        then
            if
                $cocaStage < 3
            then
                gosub @COCA_ADVANCE_STAGE_3
            end
        end
        if
            $cocaGrowTicks > 3600
        then
            if
                $cocaStage < 3
            then
                gosub @COCA_ADVANCE_STAGE_3
            end
        end
        if
            $cocaReady == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord $cocaX $cocaY $cocaZ radius 4.0 4.0 8.0 sphere 0
            then
                if
                    $cocaPrompt == 0
                then
                    print_help_string "Harvest coca. Press H"
                    $cocaPrompt = 1
                end
                if
                    is_key_just_pressed 72
                then
                    gosub @HARVEST_COCA
                    wait 500
                end
            else
                $cocaPrompt = 0
            end
        end
    end

    if
        $workerSeeds > 0
    then
        if
            $workerHarvestReady == 0
        then
            elapsed = nowTime
            elapsed -= $workerGrowStart
            if
                elapsed > 120000
            then
                $workerHarvestReady = 1
                $workerHarvestGrams = $workerSeeds
                $workerHarvestGrams *= 50
                print_string_now "TYRELL~n~Worker cannabis ready" 5000
            end
        end
    end

    if
        $workerAkActive == 1
    then
        if
            $workerAkReady == 0
        then
            elapsed = nowTime
            elapsed -= $workerAkStart
            if
                elapsed > 300000
            then
                $workerAkReady = 1
                print_string_now "TYRELL~n~AK-47 plant ready" 5000
            end
        end
    end

    if
        $farmCrewSpawned == 1
    then
        if
            $cocaineBreakthroughDone == 1
        then
            if
                $farmCocaAutoStarted == 0
            then
                gosub @FARM_START_COCA_AUTO
            end
        end
        if
            $farmHarvestReady == 0
        then
            elapsed = nowTime
            elapsed -= $farmGrowStart
            if
                elapsed > 120000
            then
                $farmHarvestReady = 1
                $farmAkReadyGrams = $farmAkSeeds
                $farmAkReadyGrams *= 75
                $farmOpiumReady = $farmPoppySeeds
                $farmOpiumReady *= 40
                $farmCocaLeavesReady = $farmCocaSeeds
                $farmCocaLeavesReady *= 45
                $farmCocaSeedsReady = $farmCocaSeeds
                $farmCocaSeedsReady *= 2
                print_string_now "HILLTOP FARM~n~Crew harvest ready" 5000
            end
        end
    end

    if
        $mission2AutoStart == 1
    then
        if
            $mission2Started == 0
        then
            $mission2AutoStart = 0
            wait 2000
            gosub @START_MISSION_II
        end
    end

    if
        00FE: locate_char_any_means_3d $scplayer coord 2467.4016 -1755.2 13.0 radius 1.4 1.4 1.2 sphere 0
    then
        if
            inSupplier == 0
        then
            if
                $mission7Started > 0
            then
                print_help_string "Supplier: Y seed pack, O buy 3 poppy seeds"
            else
                if
                    $supplierAkTalkUnlocked == 1
                then
                    if
                        $supplierAkTalkDone == 0
                    then
                        print_help_string "Supplier: Y buy seed pack, T talk AK-47"
                    else
                        if
                            $mission3Unlocked == 1
                        then
                            print_help_string "Supplier: Y buy seed pack, T start Mission III"
                        else
                            print_help_string "Supplier: Press Y to buy 1 seed pack for $330"
                        end
                    end
                else
                    if
                        $mission3Unlocked == 1
                    then
                        print_help_string "Supplier: Y buy seed pack, T start Mission III"
                    else
                        if
                            $mission2Ready == 2
                        then
                            if
                                $mission2Complete == 0
                            then
                                if
                                    $mission2Started == 0
                                then
                                    print_help_string "Supplier: Y buy seed pack, T start Mission II"
                                else
                                    print_help_string "Mission II: Take the briefcase near the robber"
                                end
                            else
                                print_help_string "Supplier: Press Y to buy 1 seed pack for $330"
                            end
                        else
                            print_help_string "Supplier: Press Y to buy 1 seed pack for $330"
                        end
                    end
                end
            end
            inSupplier = 1
        end

        if
            is_key_just_pressed 79
        then
            if
                $mission7Started > 0
            then
                if
                    010A: is_score_greater $player1 than 599
                then
                    0109: add_score $player1 value -600
                    $poppySeeds += 3
                    print_string_now "Bought 3 poppy seeds" 3000
                    if
                        $mission7Started == 1
                    then
                        $mission7Started = 2
                        wait 2500
                        print_string_now "MISSION PASSED VII~n~Poppy Seeds" 6000
                        wait 2500
                        print_string_now "Press TAB+O to plant poppy seeds" 5000
                    end
                else
                    print_string_now "Not enough money" 3000
                end
            else
                print_string_now "Poppy seeds are not available yet" 3000
            end
            wait 500
        end

        if
            is_key_just_pressed 89
        then
            if
                010A: is_score_greater $player1 than 329
            then
                0109: add_score $player1 value -330
                seedPacks += 1
                print_string_now "Bought 1 seed pack" 3000

                if
                    missionStage == 1
                then
                    016A: fade 0 time 1000
                    wait 1200
                    016A: fade 1 time 1000
                    wait 1200
                    missionStage = 2
                    print_string_now "OBJECTIVE~n~Plant the seed pack somewhere hidden" 5000
                    wait 2500
                    print_help_string "Press P to plant your seed pack. Avoid detection"
                end
            else
                print_string_now "Not enough money" 3000
            end
            wait 500
        end

        if
            0AB0: key_pressed 77
        then
            if
                $mission2Complete == 1
            then
                print_string_now "Mission II already completed" 3000
            else
                if
                    $mission2Ready == 2
                then
                    $mission2Unlocked = 1
                    if
                        $mission2Started == 0
                    then
                        $mission2Started = 1
                        016A: fade 0 time 1000
                        wait 1200
                        016A: fade 1 time 1000
                        wait 1200
                        print_string_now "MISSION II" 5000
                        wait 2500
                        0ACE: show_formatted_text_box "Supplier: Some Vagos hit my stash last night."
                        wait 3500
                        0ACE: show_formatted_text_box "Supplier: Find the one holding my bag."
                        wait 3500
                        0ACE: show_formatted_text_box "Supplier: Whatever else you find, keep it. I just want payback."
                        wait 4000

                        request_model #LSV3
                        request_model #COLT45
                        request_model 1210

                        while not has_model_loaded #LSV3
                            wait 0
                        end
                        while not has_model_loaded #COLT45
                            wait 0
                        end
                        while not has_model_loaded 1210
                            wait 0
                        end

                        $vagosEnemy = create_char 4 #LSV3 at 2785.0 -1620.0 10.9
                        set_char_heading $vagosEnemy 270.0
                        01B2: give_actor $vagosEnemy weapon 22 ammo 150
                        02E2: set_actor $vagosEnemy weapon_accuracy_to 45
                        05E2: AS_actor $vagosEnemy kill_actor $scplayer
                        $missionBriefcase = create_object 1210 at 2787.0 -1620.0 10.9
                        04CE: add_short_range_sprite_blip_for_coord 2787.0 -1620.0 10.9 sprite 37 store_to briefcaseBlip

                        mark_model_as_no_longer_needed #LSV3
                        mark_model_as_no_longer_needed #COLT45
                        mark_model_as_no_longer_needed 1210

                        print_string_now "OBJECTIVE~n~Take the briefcase near the robber" 5000
                    else
                        print_string_now "Mission II already started~n~Take the briefcase" 3000
                    end
                else
                    0AD1: show_formatted_text_highpriority "Mission II needs 2 harvested cannabis plants~n~Mission II progress:%d/2" time 4000 $mission2Ready
                end
            end
            wait 1000
        end

        if
            is_key_just_pressed 84
        then
            if
                $supplierAkTalkUnlocked == 1
            then
                if
                    $supplierAkTalkDone == 0
                then
                    $supplierAkTalkDone = 1
                    0ACE: show_formatted_text_box "CJ: That AK-47 strain is worth real money."
                    wait 3500
                    0ACE: show_formatted_text_box "CJ: Where do I get more?"
                    wait 3500
                    0ACE: show_formatted_text_box "Supplier: Heard about some grows in the hills north of Los Santos."
                    wait 4000
                    0ACE: show_formatted_text_box "Supplier: Find the right people up there, and you'll find better seeds."
                    wait 4000
                    print_string_now "AK-47 lead discovered~n~The hills will be available in Mission III" 6000
                else
                    if
                        $mission3Unlocked == 1
                    then
                        $mission3Unlocked = 2
                        016A: fade 0 time 1000
                        wait 1200
                        016A: fade 1 time 1000
                        wait 1200
                        print_string_now "MISSION III" 5000
                        wait 2500
                        0ACE: show_formatted_text_box "CJ: I need something bigger than street grows."
                        wait 3500
                        0ACE: show_formatted_text_box "Supplier: Then you need to leave Grove behind for a minute."
                        wait 4000
                        0ACE: show_formatted_text_box "Supplier: There is an AK-47 grow hidden in the hills north of Los Santos."
                        wait 4500
                        0ACE: show_formatted_text_box "Supplier: It is guarded. If you go, go ready."
                        wait 4000
                        print_string_now "LEAD DISCOVERED~n~Mission III begins in the hills" 6000
                        wait 2000
                        gosub @START_MISSION_III
                    else
                        print_string_now "You already talked about AK-47" 3000
                    end
                end
            else
                if
                    $mission3Unlocked == 1
                then
                    $mission3Unlocked = 2
                    016A: fade 0 time 1000
                    wait 1200
                    016A: fade 1 time 1000
                    wait 1200
                    print_string_now "MISSION III" 5000
                    wait 2500
                    0ACE: show_formatted_text_box "CJ: I need something bigger than street grows."
                    wait 3500
                    0ACE: show_formatted_text_box "Supplier: Then you need to leave Grove behind for a minute."
                    wait 4000
                    0ACE: show_formatted_text_box "Supplier: There is an AK-47 grow hidden in the hills north of Los Santos."
                    wait 4500
                    0ACE: show_formatted_text_box "Supplier: It is guarded. If you go, go ready."
                    wait 4000
                    print_string_now "LEAD DISCOVERED~n~Mission III begins in the hills" 6000
                    wait 2000
                    gosub @START_MISSION_III
                else
                    if
                        $mission2Ready == 2
                    then
                    if
                        $mission2Complete == 0
                    then
                        if
                            $mission2Started == 0
                        then
                            gosub @START_MISSION_II
                        else
                            print_string_now "Mission II already started~n~Take the briefcase" 3000
                        end
                    end
                    end
                end
            end
            wait 500
        end
    else
        inSupplier = 0
    end

    if
        $mission2Started == 1
    then
        if
            $mission2Complete == 0
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord 2787.0 -1620.0 10.9 radius 2.0 2.0 2.0 sphere 0
            then
                $mission2Complete = 1
                $mission2Ready = 0
                $mission3Ready = 0
                $mission3Unlocked = 0
                if
                    briefcaseBlip <> -1
                then
                    0164: remove_blip briefcaseBlip
                    briefcaseBlip = -1
                end
                delete_object $missionBriefcase
                $akSeedPacks += 1
                seedPacks += 2
                print_string_now "MISSION PASSED~n~Found 2 seed packs and 1 AK-47 seed pack" 6000
                wait 3000
                print_string_now "Press TAB+P to plant AK-47 cannabis" 5000
                wait 3000
                print_string_now "MISSION III PROGRESS~n~Harvest 3 more regular plants" 5000
            end
        end
    end

    if
        00FE: locate_char_any_means_3d $scplayer coord 2305.7 -1794.9 13.5468 radius 1.4 1.4 1.2 sphere 0
    then
        if
            inBuyer == 0
        then
            if
                missionStage == 4
            then
                print_help_string "Buyer: Press Y to sell marijuana and finish the job"
            else
                print_help_string "Buyer: Press Y to open sell menu, or N to leave"
            end
            inBuyer = 1
        end

        if
            is_key_just_pressed 89
        then
            sellMenu = 1
            if
                $akWeedGrams > 0
            then
                if
                    $mission4Started == 1
                then
                    if
                        $mission4Complete == 0
                    then
                        0AD1: show_formatted_text_highpriority "SELL MENU~n~1 Weed 1g $10~n~2 Weed 10g $100~n~3 Weed 20g $200~n~Mission IV: do not sell AK-47 yet" time 7000
                    else
                        0AD1: show_formatted_text_highpriority "SELL MENU~n~1 Weed1  2 Weed10  3 Weed20~n~4 AK1  5 AK10  6 AK20~n~N close" time 7000
                    end
                else
                    0AD1: show_formatted_text_highpriority "SELL MENU~n~1 Weed1  2 Weed10  3 Weed20~n~4 AK1  5 AK10  6 AK20~n~N close" time 7000
                end
            else
                0AD1: show_formatted_text_highpriority "SELL MENU~n~1 Weed 1g $10~n~2 Weed 10g $100~n~3 Weed 20g $200~n~N close" time 7000
            end
            wait 500
        end

        if
            is_key_just_pressed 78
        then
            sellMenu = 0
            print_string_now "Closed sell menu" 2000
            wait 500
        end
    else
        inBuyer = 0
        sellMenu = 0
    end

    if
        sellMenu == 1
    then
        if
            is_key_just_pressed 49
        then
            if
                weedGrams > 0
            then
                weedGrams -= 1
                0109: add_score $player1 value 10
                gramsSoldSinceHeat += 1
                totalGramsSold += 1
                print_string_now "Sold 1g for $10" 3000
                gosub @AFTER_REGULAR_SALE
            else
                print_string_now "Not enough weed" 3000
            end
            wait 500
        end

        if
            is_key_just_pressed 50
        then
            if
                weedGrams > 9
            then
                weedGrams -= 10
                0109: add_score $player1 value 100
                gramsSoldSinceHeat += 10
                totalGramsSold += 10
                print_string_now "Sold 10g for $100" 3000
                gosub @AFTER_REGULAR_SALE
            else
                print_string_now "Not enough weed" 3000
            end
            wait 500
        end

        if
            is_key_just_pressed 51
        then
            if
                weedGrams > 19
            then
                weedGrams -= 20
                0109: add_score $player1 value 200
                gramsSoldSinceHeat += 20
                totalGramsSold += 20
                print_string_now "Sold 20g for $200" 3000
                gosub @AFTER_REGULAR_SALE
            else
                print_string_now "Not enough weed" 3000
            end
            wait 500
        end

        if
            $akWeedGrams > 0
        then
            if
                is_key_just_pressed 52
            then
                if
                    $mission4Started == 1
                then
                    if
                        $mission4Complete == 0
                    then
                        print_string_now "MISSION IV~n~Do not sell AK-47 yet" 4000
                    else
                        if
                            $akWeedGrams > 0
                        then
                            $akWeedGrams -= 1
                            0109: add_score $player1 value 14
                            gramsSoldSinceHeat += 1
                            totalGramsSold += 1
                            print_string_now "Sold 1g AK-47 for $14" 3000
                            gosub @AFTER_AK_SALE
                        else
                            print_string_now "Not enough AK-47" 3000
                        end
                    end
                else
                    if
                        $akWeedGrams > 0
                    then
                        $akWeedGrams -= 1
                        0109: add_score $player1 value 14
                        gramsSoldSinceHeat += 1
                        totalGramsSold += 1
                        print_string_now "Sold 1g AK-47 for $14" 3000
                        gosub @AFTER_AK_SALE
                    else
                        print_string_now "Not enough AK-47" 3000
                    end
                end
                wait 500
            end

            if
                is_key_just_pressed 53
            then
                if
                    $mission4Started == 1
                then
                    if
                        $mission4Complete == 0
                    then
                        print_string_now "MISSION IV~n~Do not sell AK-47 yet" 4000
                    else
                        if
                            $akWeedGrams > 9
                        then
                            $akWeedGrams -= 10
                            0109: add_score $player1 value 140
                            gramsSoldSinceHeat += 10
                            totalGramsSold += 10
                            print_string_now "Sold 10g AK-47 for $140" 3000
                            gosub @AFTER_AK_SALE
                        else
                            print_string_now "Not enough AK-47" 3000
                        end
                    end
                else
                    if
                        $akWeedGrams > 9
                    then
                        $akWeedGrams -= 10
                        0109: add_score $player1 value 140
                        gramsSoldSinceHeat += 10
                        totalGramsSold += 10
                        print_string_now "Sold 10g AK-47 for $140" 3000
                        gosub @AFTER_AK_SALE
                    else
                        print_string_now "Not enough AK-47" 3000
                    end
                end
                wait 500
            end

            if
                is_key_just_pressed 54
            then
                if
                    $mission4Started == 1
                then
                    if
                        $mission4Complete == 0
                    then
                        print_string_now "MISSION IV~n~Do not sell AK-47 yet" 4000
                    else
                        if
                            $akWeedGrams > 19
                        then
                            $akWeedGrams -= 20
                            0109: add_score $player1 value 280
                            gramsSoldSinceHeat += 20
                            totalGramsSold += 20
                            print_string_now "Sold 20g AK-47 for $280" 3000
                            gosub @AFTER_AK_SALE
                        else
                            print_string_now "Not enough AK-47" 3000
                        end
                    end
                else
                    if
                        $akWeedGrams > 19
                    then
                        $akWeedGrams -= 20
                        0109: add_score $player1 value 280
                        gramsSoldSinceHeat += 20
                        totalGramsSold += 20
                        print_string_now "Sold 20g AK-47 for $280" 3000
                        gosub @AFTER_AK_SALE
                    else
                        print_string_now "Not enough AK-47" 3000
                    end
                end
                wait 500
            end
        end
    end

    if
        gramsSoldSinceHeat > 49
    then
        $drugHeat += 5
        gramsSoldSinceHeat -= 50
        0AD1: show_formatted_text_highpriority "+5 HEAT~n~Current heat: %d" time 4000 $drugHeat
    end

    if
        $akFirstSaleCallPending == 1
    then
        if
            $akFirstSaleCallShown == 0
        then
            elapsed = nowTime
            elapsed -= $akSaleCallStart
            if
                elapsed > 20000
            then
                $akFirstSaleCallShown = 1
                $akFirstSaleCallPending = 0
                print_string_now "PHONE CALL" 3000
                wait 2500
                0ACE: show_formatted_text_box "Buyer: That weed you sold me... that's AK-47."
                wait 3500
                0ACE: show_formatted_text_box "Buyer: People will pay better money for that kind of smoke."
                wait 3500
                if
                    $akWeedGrams > 0
                then
                    0ACE: show_formatted_text_box "Buyer: If you still got some, head to the beach."
                    wait 3500
                end
                $supplierAkTalkUnlocked = 1
                print_string_now "Talk to the supplier about AK-47" 5000
            end
        end
    end

    if
        $harvestedCrops > 1
    then
        if
            $mission2Unlocked == 0
        then
            $mission2Unlocked = 1
            $mission2Ready = 2
            $mission2Started = 0
            $mission2Complete = 0
            maxPlants = 2
            print_string_now "MISSION II AVAILABLE~n~Return to the supplier and press T" 6000
        end
    end

    if
        is_key_just_pressed 80
    then
        if
            0AB0: key_pressed 9
        then
            if
                $akSeedPacks > 0
            then
                gosub @PLANT_AK
            else
                print_string_now "You have no AK-47 seed packs" 3000
            end
        else
            if
                seedPacks > 0
            then
                gosub @PLANT_REGULAR
            else
                print_string_now "You have no seed packs" 3000
            end
        end
        wait 500
    end

    if
        $planted1 == 1
    then
        if
            $plantReady1 == 0
        then
            elapsed = nowTime
            elapsed -= $plantStart1
            if
                elapsed > 20000
            then
                if
                    $growStage1 == 0
                then
                    request_model 3409
                    while not has_model_loaded 3409
                        wait 0
                    end
                    $weedPlant1 = create_object 3409 at $plant1X $plant1Y $plant1Z
                    08D2: set_object_scale $weedPlant1 to 0.08
                    mark_model_as_no_longer_needed 3409
                    $growStage1 = 1
                end
            end
            if
                elapsed > 40000
            then
                if
                    $growStage1 == 1
                then
                    if
                        $plantType1 == 2
                    then
                        08D2: set_object_scale $weedPlant1 to 0.35
                    else
                        08D2: set_object_scale $weedPlant1 to 0.25
                    end
                    $growStage1 = 2
                end
            end
            if
                elapsed > 60000
            then
                if
                    $growStage1 == 2
                then
                    if
                        $plantType1 == 2
                    then
                        08D2: set_object_scale $weedPlant1 to 0.60
                    else
                        08D2: set_object_scale $weedPlant1 to 0.50
                    end
                    $growStage1 = 3
                    $plantReady1 = 1
                    0188: add_blip_for_object $weedPlant1 store_to $plantBlip1
                    0165: change_blip_colour $plantBlip1 to 3
                    018B: change_blip_display $plantBlip1 to 3
                    print_string_now "Plant ready to harvest" 3000
                end
            end
        end

        if
            $plantReady1 == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord $plant1X $plant1Y $plant1Z radius 2.0 2.0 2.0 sphere 0
            then
                if
                    $harvestPrompt1 == 0
                then
                    print_help_string "Harvest possible. Press H"
                    $harvestPrompt1 = 1
                end
                if
                    is_key_just_pressed 72
                then
                    gosub @HARVEST_PLANT1
                    wait 500
                end
            else
                $harvestPrompt1 = 0
            end
        end
    end

    if
        $planted2 == 1
    then
        if
            $plantReady2 == 0
        then
            elapsed = nowTime
            elapsed -= $plantStart2
            if
                elapsed > 20000
            then
                if
                    $growStage2 == 0
                then
                    request_model 3409
                    while not has_model_loaded 3409
                        wait 0
                    end
                    $weedPlant2 = create_object 3409 at $plant2X $plant2Y $plant2Z
                    08D2: set_object_scale $weedPlant2 to 0.08
                    mark_model_as_no_longer_needed 3409
                    $growStage2 = 1
                end
            end
            if
                elapsed > 40000
            then
                if
                    $growStage2 == 1
                then
                    if
                        $plantType2 == 2
                    then
                        08D2: set_object_scale $weedPlant2 to 0.35
                    else
                        08D2: set_object_scale $weedPlant2 to 0.25
                    end
                    $growStage2 = 2
                end
            end
            if
                elapsed > 60000
            then
                if
                    $growStage2 == 2
                then
                    if
                        $plantType2 == 2
                    then
                        08D2: set_object_scale $weedPlant2 to 0.60
                    else
                        08D2: set_object_scale $weedPlant2 to 0.50
                    end
                    $growStage2 = 3
                    $plantReady2 = 1
                    0188: add_blip_for_object $weedPlant2 store_to $plantBlip2
                    0165: change_blip_colour $plantBlip2 to 3
                    018B: change_blip_display $plantBlip2 to 3
                    print_string_now "Plant ready to harvest" 3000
                end
            end
        end

        if
            $plantReady2 == 1
        then
            if
                00FE: locate_char_any_means_3d $scplayer coord $plant2X $plant2Y $plant2Z radius 2.0 2.0 2.0 sphere 0
            then
                if
                    $harvestPrompt2 == 0
                then
                    print_help_string "Harvest possible. Press H"
                    $harvestPrompt2 = 1
                end
                if
                    is_key_just_pressed 72
                then
                    gosub @HARVEST_PLANT2
                    wait 500
                end
            else
                $harvestPrompt2 = 0
            end
        end
    end
end

:SAVE_DRUG_BUSINESS_PROGRESS
print_string_now "WRITING DRUG LEDGER" 2000
wait 500
gosub @NORMALIZE_LEDGER_STORY_STATE
010B: store_score $player1 to $dbSaveMoney
0AF1: write_int_to_ini_file 1 path "cleo\drug_business_ledger.ini" section "Meta" key "has_save"
0AF1: write_int_to_ini_file $dbSaveMoney path "cleo\drug_business_ledger.ini" section "Status" key "money"
0AF1: write_int_to_ini_file seedPacks path "cleo\drug_business_ledger.ini" section "Inventory" key "seed_packs"
0AF1: write_int_to_ini_file weedGrams path "cleo\drug_business_ledger.ini" section "Inventory" key "weed_grams"
0AF1: write_int_to_ini_file $akSeedPacks path "cleo\drug_business_ledger.ini" section "Inventory" key "ak_seed_packs"
0AF1: write_int_to_ini_file $akWeedGrams path "cleo\drug_business_ledger.ini" section "Inventory" key "ak_grams"
0AF1: write_int_to_ini_file $ecstasyPills path "cleo\drug_business_ledger.ini" section "Inventory" key "ecstasy"
0AF1: write_int_to_ini_file $poppySeeds path "cleo\drug_business_ledger.ini" section "Inventory" key "poppy_seeds"
0AF1: write_int_to_ini_file $opiumGrams path "cleo\drug_business_ledger.ini" section "Inventory" key "opium"
0AF1: write_int_to_ini_file $heroinGrams path "cleo\drug_business_ledger.ini" section "Inventory" key "heroin"
0AF1: write_int_to_ini_file $lsdTabs path "cleo\drug_business_ledger.ini" section "Inventory" key "lsd"
0AF1: write_int_to_ini_file $mushroomPacks path "cleo\drug_business_ledger.ini" section "Inventory" key "mushrooms"
0AF1: write_int_to_ini_file $mysterySeeds path "cleo\drug_business_ledger.ini" section "Inventory" key "mystery_seeds"
0AF1: write_int_to_ini_file $cocaSeeds path "cleo\drug_business_ledger.ini" section "Inventory" key "coca_seeds"
0AF1: write_int_to_ini_file $cocaLeaves path "cleo\drug_business_ledger.ini" section "Inventory" key "coca_leaves"
0AF1: write_int_to_ini_file $cocaineGrams path "cleo\drug_business_ledger.ini" section "Inventory" key "cocaine"
0AF1: write_int_to_ini_file $drugHeat path "cleo\drug_business_ledger.ini" section "Status" key "heat"
0AF1: write_int_to_ini_file $slingingRepBeach path "cleo\drug_business_ledger.ini" section "Status" key "beach_rep"
0AF1: write_int_to_ini_file $nightlifeRep path "cleo\drug_business_ledger.ini" section "Status" key "nightlife_rep"
0AF1: write_int_to_ini_file totalGramsSold path "cleo\drug_business_ledger.ini" section "Status" key "total_sold"
0AF1: write_int_to_ini_file $slingDeals path "cleo\drug_business_ledger.ini" section "Status" key "sling_deals"
0AF1: write_int_to_ini_file $harvestedCrops path "cleo\drug_business_ledger.ini" section "Status" key "harvested_crops"
0AF1: write_int_to_ini_file $regularHarvestedGrams path "cleo\drug_business_ledger.ini" section "Status" key "regular_harvested"
0AF1: write_int_to_ini_file maxPlants path "cleo\drug_business_ledger.ini" section "Status" key "max_plants"
0AF1: write_int_to_ini_file missionStage path "cleo\drug_business_ledger.ini" section "Progress" key "mission_stage"
0AF1: write_int_to_ini_file firstSaleTextShown path "cleo\drug_business_ledger.ini" section "Progress" key "first_sale_text_shown"
0AF1: write_int_to_ini_file buyerDiscovered path "cleo\drug_business_ledger.ini" section "Progress" key "buyer_discovered"
0AF1: write_int_to_ini_file $mission2Unlocked path "cleo\drug_business_ledger.ini" section "Progress" key "mission2_unlocked"
0AF1: write_int_to_ini_file $mission2Started path "cleo\drug_business_ledger.ini" section "Progress" key "mission2_started"
0AF1: write_int_to_ini_file $mission2Ready path "cleo\drug_business_ledger.ini" section "Progress" key "mission2_ready"
0AF1: write_int_to_ini_file $mission2Complete path "cleo\drug_business_ledger.ini" section "Progress" key "mission2_complete"
0AF1: write_int_to_ini_file $mission3Unlocked path "cleo\drug_business_ledger.ini" section "Progress" key "mission3_unlocked"
0AF1: write_int_to_ini_file $mission3Started path "cleo\drug_business_ledger.ini" section "Progress" key "mission3_started"
0AF1: write_int_to_ini_file $mission3Ready path "cleo\drug_business_ledger.ini" section "Progress" key "mission3_ready"
0AF1: write_int_to_ini_file $mission3Harvested path "cleo\drug_business_ledger.ini" section "Progress" key "mission3_harvested"
0AF1: write_int_to_ini_file $mission3PhoneDone path "cleo\drug_business_ledger.ini" section "Progress" key "mission3_phone_done"
0AF1: write_int_to_ini_file $mission4Started path "cleo\drug_business_ledger.ini" section "Progress" key "mission4_started"
0AF1: write_int_to_ini_file $mission4AkHarvested path "cleo\drug_business_ledger.ini" section "Progress" key "mission4_ak_harvested"
0AF1: write_int_to_ini_file $mission4Complete path "cleo\drug_business_ledger.ini" section "Progress" key "mission4_complete"
0AF1: write_int_to_ini_file $mission5Started path "cleo\drug_business_ledger.ini" section "Progress" key "mission5_started"
0AF1: write_int_to_ini_file $mission5CallDone path "cleo\drug_business_ledger.ini" section "Progress" key "mission5_call_done"
0AF1: write_int_to_ini_file $mission6Started path "cleo\drug_business_ledger.ini" section "Progress" key "mission6_started"
0AF1: write_int_to_ini_file $mission6SoldGrams path "cleo\drug_business_ledger.ini" section "Progress" key "mission6_sold"
0AF1: write_int_to_ini_file $mission7Started path "cleo\drug_business_ledger.ini" section "Progress" key "mission7_started"
0AF1: write_int_to_ini_file $mission8Unlocked path "cleo\drug_business_ledger.ini" section "Progress" key "mission8_unlocked"
0AF1: write_int_to_ini_file $mission8Started path "cleo\drug_business_ledger.ini" section "Progress" key "mission8_started"
0AF1: write_int_to_ini_file $mission8Complete path "cleo\drug_business_ledger.ini" section "Progress" key "mission8_complete"
0AF1: write_int_to_ini_file $mission9Started path "cleo\drug_business_ledger.ini" section "Progress" key "mission9_started"
0AF1: write_int_to_ini_file $mission9Sales path "cleo\drug_business_ledger.ini" section "Progress" key "mission9_sales"
0AF1: write_int_to_ini_file $slingingUnlocked path "cleo\drug_business_ledger.ini" section "Progress" key "slinging_unlocked"
0AF1: write_int_to_ini_file $chemistUnlocked path "cleo\drug_business_ledger.ini" section "Progress" key "chemist_unlocked"
0AF1: write_int_to_ini_file $chemistDiscovered path "cleo\drug_business_ledger.ini" section "Progress" key "chemist_discovered"
0AF1: write_int_to_ini_file $ecstasyDealerDeals path "cleo\drug_business_ledger.ini" section "Progress" key "dealer_deals"
0AF1: write_int_to_ini_file $ecstasyDealerStage path "cleo\drug_business_ledger.ini" section "Progress" key "dealer_stage"
0AF1: write_int_to_ini_file $mayaUnlocked path "cleo\drug_business_ledger.ini" section "Progress" key "maya_unlocked"
0AF1: write_int_to_ini_file $mayaIntroSpawned path "cleo\drug_business_ledger.ini" section "Progress" key "maya_intro_spawned"
0AF1: write_int_to_ini_file $mayaObjectiveStarted path "cleo\drug_business_ledger.ini" section "Progress" key "maya_objective_started"
0AF1: write_int_to_ini_file $nightlifeSlingingUnlocked path "cleo\drug_business_ledger.ini" section "Progress" key "nightlife_unlocked"
0AF1: write_int_to_ini_file $growhouseOwned path "cleo\drug_business_ledger.ini" section "Properties" key "growhouse_owned"
0AF1: write_int_to_ini_file $farmOwned path "cleo\drug_business_ledger.ini" section "Properties" key "farm_owned"
0AF1: write_int_to_ini_file $tyrellCrewSpawned path "cleo\drug_business_ledger.ini" section "Crew" key "tyrell_spawned"
0AF1: write_int_to_ini_file $workerSeeds path "cleo\drug_business_ledger.ini" section "Crew" key "worker_seeds"
0AF1: write_int_to_ini_file $workerHarvestReady path "cleo\drug_business_ledger.ini" section "Crew" key "worker_harvest_ready"
0AF1: write_int_to_ini_file $workerHarvestGrams path "cleo\drug_business_ledger.ini" section "Crew" key "worker_harvest_grams"
0AF1: write_int_to_ini_file $workerAkActive path "cleo\drug_business_ledger.ini" section "Crew" key "worker_ak_active"
0AF1: write_int_to_ini_file $farmCrewSpawned path "cleo\drug_business_ledger.ini" section "Farm" key "crew_spawned"
0AF1: write_int_to_ini_file $farmAkSeeds path "cleo\drug_business_ledger.ini" section "Farm" key "ak_seeds"
0AF1: write_int_to_ini_file $farmPoppySeeds path "cleo\drug_business_ledger.ini" section "Farm" key "poppy_seeds"
0AF1: write_int_to_ini_file $farmCocaSeeds path "cleo\drug_business_ledger.ini" section "Farm" key "coca_seeds"
0AF1: write_int_to_ini_file $farmHarvestReady path "cleo\drug_business_ledger.ini" section "Farm" key "harvest_ready"
0AF1: write_int_to_ini_file $morganFarmMoved path "cleo\drug_business_ledger.ini" section "Lab" key "morgan_moved"
0AF1: write_int_to_ini_file $morganProcessDeals path "cleo\drug_business_ledger.ini" section "Lab" key "process_deals"
0AF1: write_int_to_ini_file $morganLsdReady path "cleo\drug_business_ledger.ini" section "Lab" key "lsd_ready"
0AF1: write_int_to_ini_file $empirePhaseUnlocked path "cleo\drug_business_ledger.ini" section "Empire" key "empire_unlocked"
0AF1: write_int_to_ini_file $mexicanContactTalked path "cleo\drug_business_ledger.ini" section "Empire" key "mexican_contact_done"
0AF1: write_int_to_ini_file $cocaineBreakthroughDone path "cleo\drug_business_ledger.ini" section "Empire" key "cocaine_breakthrough"
$dbSaveSlotUsed = 1
0AD1: show_formatted_text_highpriority "DRUG LEDGER SAVED~n~Progress written to CLEO file" time 5000
return

:LOAD_DRUG_BUSINESS_PROGRESS
print_string_now "READING DRUG LEDGER" 2000
wait 500
0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Meta" key "has_save" store_to $dbSaveSlotUsed
if
    $dbSaveSlotUsed == 1
then
    if
        $tyrellCrewSpawned == 1
    then
        009B: destroy_actor $tyrell
        009B: destroy_actor $groveWorker
        if
            $workerAkActive == 1
        then
            delete_object $workerAkPlant
        end
        $tyrellCrewSpawned = 0
    end
    if
        $farmCrewSpawned == 1
    then
        009B: destroy_actor $farmWorker1
        009B: destroy_actor $farmWorker2
        delete_object $farmPoppyPlant
        delete_object $farmPoppyPlant2
        delete_object $farmPoppyPlant3
        delete_object $farmPoppyPlant4
        delete_object $farmAkPlant
        $farmCrewSpawned = 0
    end
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Status" key "money" store_to $dbSaveMoney
    if
        $dbSaveMoney > 0
    then
        010B: store_score $player1 to $dbSaveCurrentMoney
        $dbSaveCurrentMoney *= -1
        0109: add_score $player1 value $dbSaveCurrentMoney
        0109: add_score $player1 value $dbSaveMoney
    end
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "seed_packs" store_to seedPacks
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "weed_grams" store_to weedGrams
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "ak_seed_packs" store_to $akSeedPacks
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "ak_grams" store_to $akWeedGrams
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "ecstasy" store_to $ecstasyPills
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "poppy_seeds" store_to $poppySeeds
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "opium" store_to $opiumGrams
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "heroin" store_to $heroinGrams
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "lsd" store_to $lsdTabs
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "mushrooms" store_to $mushroomPacks
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "mystery_seeds" store_to $mysterySeeds
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "coca_seeds" store_to $cocaSeeds
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "coca_leaves" store_to $cocaLeaves
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Inventory" key "cocaine" store_to $cocaineGrams
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Status" key "heat" store_to $drugHeat
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Status" key "beach_rep" store_to $slingingRepBeach
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Status" key "nightlife_rep" store_to $nightlifeRep
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Status" key "total_sold" store_to totalGramsSold
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Status" key "sling_deals" store_to $slingDeals
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Status" key "harvested_crops" store_to $harvestedCrops
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Status" key "regular_harvested" store_to $regularHarvestedGrams
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Status" key "max_plants" store_to maxPlants
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission_stage" store_to missionStage
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "first_sale_text_shown" store_to firstSaleTextShown
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "buyer_discovered" store_to buyerDiscovered
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission2_unlocked" store_to $mission2Unlocked
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission2_started" store_to $mission2Started
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission2_ready" store_to $mission2Ready
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission2_complete" store_to $mission2Complete
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission3_unlocked" store_to $mission3Unlocked
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission3_started" store_to $mission3Started
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission3_ready" store_to $mission3Ready
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission3_harvested" store_to $mission3Harvested
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission3_phone_done" store_to $mission3PhoneDone
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission4_started" store_to $mission4Started
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission4_ak_harvested" store_to $mission4AkHarvested
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission4_complete" store_to $mission4Complete
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission5_started" store_to $mission5Started
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission5_call_done" store_to $mission5CallDone
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission6_started" store_to $mission6Started
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission6_sold" store_to $mission6SoldGrams
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission7_started" store_to $mission7Started
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission8_unlocked" store_to $mission8Unlocked
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission8_started" store_to $mission8Started
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission8_complete" store_to $mission8Complete
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission9_started" store_to $mission9Started
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "mission9_sales" store_to $mission9Sales
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "slinging_unlocked" store_to $slingingUnlocked
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "chemist_unlocked" store_to $chemistUnlocked
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "chemist_discovered" store_to $chemistDiscovered
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "dealer_deals" store_to $ecstasyDealerDeals
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "dealer_stage" store_to $ecstasyDealerStage
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "maya_unlocked" store_to $mayaUnlocked
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "maya_intro_spawned" store_to $mayaIntroSpawned
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "maya_objective_started" store_to $mayaObjectiveStarted
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Progress" key "nightlife_unlocked" store_to $nightlifeSlingingUnlocked
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Properties" key "growhouse_owned" store_to $growhouseOwned
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Properties" key "farm_owned" store_to $farmOwned
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Crew" key "tyrell_spawned" store_to $tyrellCrewSpawned
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Crew" key "worker_seeds" store_to $workerSeeds
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Crew" key "worker_harvest_ready" store_to $workerHarvestReady
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Crew" key "worker_harvest_grams" store_to $workerHarvestGrams
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Crew" key "worker_ak_active" store_to $workerAkActive
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Farm" key "crew_spawned" store_to $farmCrewSpawned
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Farm" key "ak_seeds" store_to $farmAkSeeds
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Farm" key "poppy_seeds" store_to $farmPoppySeeds
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Farm" key "coca_seeds" store_to $farmCocaSeeds
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Farm" key "harvest_ready" store_to $farmHarvestReady
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Lab" key "morgan_moved" store_to $morganFarmMoved
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Lab" key "process_deals" store_to $morganProcessDeals
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Lab" key "lsd_ready" store_to $morganLsdReady
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Empire" key "empire_unlocked" store_to $empirePhaseUnlocked
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Empire" key "mexican_contact_done" store_to $mexicanContactTalked
    0AF0: read_int_from_ini_file "cleo\drug_business_ledger.ini" section "Empire" key "cocaine_breakthrough" store_to $cocaineBreakthroughDone
    gosub @NORMALIZE_LEDGER_STORY_STATE
    $smuggleActive = 0
    $smugglePrompt = 0
    $smuggleRoute = 0
    $smuggleStage = 0
    if
        $mission3Ready > 0
    then
        $mission2Complete = 1
    end
    if
        $mission4Complete == 1
    then
        $mission2Complete = 1
        $mission3Ready = 3
        $mission3Unlocked = 2
        $mission3Started = 1
        $mission4Started = 1
    end
    if
        $slingingUnlocked == 1
    then
        $mission2Complete = 1
        $mission3Ready = 3
        $mission3Unlocked = 2
        $mission3Started = 1
        $mission4Complete = 1
        $mission4Started = 1
        $mission5Started = 1
        $mission5CallDone = 1
    end
    if
        $mission8Complete == 1
    then
        $mission2Complete = 1
        $mission3Ready = 3
        $mission3Unlocked = 2
        $mission3Started = 1
        $mission4Complete = 1
        $mission4Started = 1
        $mission5Started = 1
        $mission5CallDone = 1
        $slingingUnlocked = 1
        $mission8Started = 2
        $mission8Unlocked = 2
    end
    if
        $farmOwned == 1
    then
        $mission2Complete = 1
        $mission3Ready = 3
        $mission3Unlocked = 2
        $mission3Started = 1
        $mission4Complete = 1
        $mission4Started = 1
        $mission5Started = 1
        $mission5CallDone = 1
        $slingingUnlocked = 1
        $mission8Complete = 1
        $mission8Started = 2
        $mission8Unlocked = 2
    end
    if
        $cocaineBreakthroughDone == 1
    then
        $mission2Complete = 1
        $mission3Ready = 3
        $mission3Unlocked = 2
        $mission3Started = 1
        $mission4Complete = 1
        $mission4Started = 1
        $mission5Started = 1
        $mission5CallDone = 1
        $slingingUnlocked = 1
        $mission8Complete = 1
        $mission8Started = 2
        $mission8Unlocked = 2
        $mayaUnlocked = 1
        $mayaIntroSpawned = 2
        $mayaObjectiveStarted = 2
        $nightlifeSlingingUnlocked = 1
        $empirePhaseUnlocked = 1
    end
    if
        $mission2Complete == 1
    then
        $mission2Unlocked = 1
        $mission2Started = 2
        $mission2Ready = 0
    end
    sellMenu = 0
    $mayaMenu = 0
    $morganMenu = 0
    $farmWorkerMenu = 0
    $tyrellMenu = 0
    $slingCustomerMenu = 0
    $nightCustomerMenu = 0
    gosub @REBUILD_LEDGER_WORLD_STATE
    0AD1: show_formatted_text_highpriority "DRUG LEDGER LOADED~n~Progress restored from CLEO file" time 5000
else
    print_string_now "NO DRUG LEDGER FOUND" 3000
end
return

:NORMALIZE_LEDGER_STORY_STATE
if
    $akSeedPacks > 0
then
    $mission2Complete = 1
end
if
    $akWeedGrams > 0
then
    $mission2Complete = 1
end
if
    $mission3Ready > 0
then
    $mission2Complete = 1
end
if
    $mission3Unlocked > 0
then
    $mission2Complete = 1
end
if
    $mission3Started > 0
then
    $mission2Complete = 1
end
if
    $mission4Started > 0
then
    $mission2Complete = 1
    $mission3Ready = 3
    $mission3Unlocked = 2
    $mission3Started = 1
    $mission3Harvested = 4
end
if
    $mission4Complete == 1
then
    $mission2Complete = 1
    $mission3Ready = 3
    $mission3Unlocked = 2
    $mission3Started = 1
    $mission3Harvested = 4
    $mission3PhoneDone = 1
    $mission4Started = 1
    $mission4AkHarvested = 2
end
if
    $slingingUnlocked == 1
then
    $mission2Complete = 1
    $mission3Ready = 3
    $mission3Unlocked = 2
    $mission3Started = 1
    $mission3Harvested = 4
    $mission3PhoneDone = 1
    $mission4Started = 1
    $mission4Complete = 1
    $mission4AkHarvested = 2
    $mission5Started = 1
    $mission5CallDone = 1
end
if
    $farmOwned == 1
then
    $mission2Complete = 1
    $mission3Ready = 3
    $mission3Unlocked = 2
    $mission3Started = 1
    $mission3Harvested = 4
    $mission3PhoneDone = 1
    $mission4Started = 1
    $mission4Complete = 1
    $mission4AkHarvested = 2
    $mission5Started = 1
    $mission5CallDone = 1
    $slingingUnlocked = 1
    $mission6Started = 2
    if
        $mission6SoldGrams < 100
    then
        $mission6SoldGrams = 100
    end
    if
        $mission7Started == 0
    then
        $mission7Started = 2
    end
    $mission8Complete = 1
    $mission8Started = 2
    $mission8Unlocked = 2
end
if
    $cocaineBreakthroughDone == 1
then
    $mission2Complete = 1
    $mission3Ready = 3
    $mission3Unlocked = 2
    $mission3Started = 1
    $mission3Harvested = 4
    $mission3PhoneDone = 1
    $mission4Started = 1
    $mission4Complete = 1
    $mission4AkHarvested = 2
    $mission5Started = 1
    $mission5CallDone = 1
    $slingingUnlocked = 1
    $mission6Started = 2
    if
        $mission6SoldGrams < 100
    then
        $mission6SoldGrams = 100
    end
    if
        $mission7Started == 0
    then
        $mission7Started = 2
    end
    $mission8Complete = 1
    $mission8Started = 2
    $mission8Unlocked = 2
    $mayaUnlocked = 1
    $mayaIntroSpawned = 2
    $mayaObjectiveStarted = 2
    $nightlifeSlingingUnlocked = 1
    $empirePhaseUnlocked = 1
end
if
    $mission2Complete == 1
then
    $mission2Unlocked = 1
    $mission2Started = 2
    $mission2Ready = 0
    $mission2AutoStart = 0
    if
        missionStage < 5
    then
        missionStage = 5
    end
    if
        firstSaleTextShown == 0
    then
        firstSaleTextShown = 1
    end
end
if
    $mission3Started > 0
then
    $mission3Ready = 3
    if
        $mission3Unlocked < 2
    then
        $mission3Unlocked = 2
    end
end
if
    $mission4Complete == 1
then
    $mission4Started = 1
    $mission4AkHarvested = 2
end
if
    $mission5CallDone == 1
then
    $mission5Started = 1
end
if
    $mission8Complete == 1
then
    $mission8Started = 2
    $mission8Unlocked = 2
end
if
    $mission9Started == 2
then
    $nightlifeSlingingUnlocked = 1
    $mayaUnlocked = 1
    if
        $mission9Sales < 5
    then
        $mission9Sales = 5
    end
end
return

:REBUILD_LEDGER_WORLD_STATE
if
    buyerDiscovered == 1
then
    if
        buyerBlip == -1
    then
        04CE: add_short_range_sprite_blip_for_coord 2306.9052 -1794.9338 13.5468 sprite 52 store_to buyerBlip
    end
end
if
    $growhouseOwned == 1
then
    if
        $growhouseBlip == -1
    then
        04CE: add_short_range_sprite_blip_for_coord 2450.5 -949.8 80.690 sprite 52 store_to $growhouseBlip
    end
    if
        $tyrellCrewSpawned == 1
    then
        $tyrellCrewSpawned = 0
        gosub @SPAWN_TYRELL_CREW
    end
end
if
    $farmOwned == 1
then
    if
        $farmBlip == -1
    then
        04CE: add_short_range_sprite_blip_for_coord 1044.4471 -332.1785 73.9850 sprite 52 store_to $farmBlip
    end
    if
        $farmCrewSpawned == 1
    then
        $farmCrewSpawned = 0
        gosub @SPAWN_FARM_CREW
    end
end
if
    $slingingUnlocked == 1
then
    $isaacDiscovered = 1
    if
        $isaacBlip == -1
    then
        04CE: add_short_range_sprite_blip_for_coord 370.0 -2046.0 8.6 sprite 52 store_to $isaacBlip
    end
end
if
    $ecstasyDealerDeals > 0
then
    if
        $ecstasyDealerBlip == -1
    then
        04CE: add_short_range_sprite_blip_for_coord 408.0 -2052.0 8.0 sprite 52 store_to $ecstasyDealerBlip
    end
    if
        $ecstasyDealerSpawned == 0
    then
        gosub @SPAWN_ECSTASY_DEALER
    end
end
if
    $mayaUnlocked == 1
then
    if
        $mayaIntroSpawned < 2
    then
        $mayaIntroSpawned = 2
    end
    if
        $mayaBlip == -1
    then
        04CE: add_short_range_sprite_blip_for_coord 1095.0 -1185.0 18.0 sprite 52 store_to $mayaBlip
    end
    if
        $mayaIntroSpawned == 2
    then
        gosub @SPAWN_MAYA_PERMANENT
    end
else
    if
        $mayaIntroSpawned == 1
    then
        gosub @SPAWN_MAYA_INTRO
    end
end
if
    $chemistDiscovered == 1
then
    if
        $morganFarmMoved == 1
    then
        if
            $chemistBlip == -1
        then
            04CE: add_short_range_sprite_blip_for_coord 1037.8 -326.0 73.9850 sprite 52 store_to $chemistBlip
        end
    else
        if
            $chemistBlip == -1
        then
            04CE: add_short_range_sprite_blip_for_coord 475.1535 -1143.6329 68.5578 sprite 52 store_to $chemistBlip
        end
    end
end
return

:START_MISSION_II
$mission2Unlocked = 1
$mission2Started = 1
016A: fade 0 time 1000
wait 1200
016A: fade 1 time 1000
wait 1200
print_string_now "MISSION II" 5000
wait 2500
0ACE: show_formatted_text_box "Supplier: Some Vagos hit my stash last night."
wait 3500
0ACE: show_formatted_text_box "Supplier: Find the one holding my bag."
wait 3500
0ACE: show_formatted_text_box "Supplier: Whatever else you find, keep it. I just want payback."
wait 4000

request_model #LSV3
request_model #COLT45
request_model 1210

while not has_model_loaded #LSV3
    wait 0
end
while not has_model_loaded #COLT45
    wait 0
end
while not has_model_loaded 1210
    wait 0
end

$vagosEnemy = create_char 4 #LSV3 at 2785.0 -1620.0 10.9
set_char_heading $vagosEnemy 270.0
01B2: give_actor $vagosEnemy weapon 22 ammo 150
02E2: set_actor $vagosEnemy weapon_accuracy_to 45
05E2: AS_actor $vagosEnemy kill_actor $scplayer
$missionBriefcase = create_object 1210 at 2787.0 -1620.0 10.9
04CE: add_short_range_sprite_blip_for_coord 2787.0 -1620.0 10.9 sprite 37 store_to briefcaseBlip

mark_model_as_no_longer_needed #LSV3
mark_model_as_no_longer_needed #COLT45
mark_model_as_no_longer_needed 1210

print_string_now "OBJECTIVE~n~Take the briefcase near the robber" 5000
return

:START_MISSION_III
$mission3Started = 1
$mission3Harvested = 0
$mission3PhoneDone = 0
$hillGuardsSpawned = 0
$hillPlantDone1 = 0
$hillPlantDone2 = 0
$hillPlantDone3 = 0
$hillPlantDone4 = 0

request_model 3409

while not has_model_loaded 3409
    wait 0
end

$hillPlant1 = create_object 3409 at 2445.8552 -950.2800 78.9
08D2: set_object_scale $hillPlant1 to 0.7
0188: add_blip_for_object $hillPlant1 store_to $hillPlantBlip1
0165: change_blip_colour $hillPlantBlip1 to 3
018B: change_blip_display $hillPlantBlip1 to 3

$hillPlant2 = create_object 3409 at 2443.3552 -950.2800 78.9
08D2: set_object_scale $hillPlant2 to 0.7
0188: add_blip_for_object $hillPlant2 store_to $hillPlantBlip2
0165: change_blip_colour $hillPlantBlip2 to 3
018B: change_blip_display $hillPlantBlip2 to 3

$hillPlant3 = create_object 3409 at 2448.3552 -950.2800 78.9
08D2: set_object_scale $hillPlant3 to 0.7
0188: add_blip_for_object $hillPlant3 store_to $hillPlantBlip3
0165: change_blip_colour $hillPlantBlip3 to 3
018B: change_blip_display $hillPlantBlip3 to 3

$hillPlant4 = create_object 3409 at 2445.8552 -953.2800 78.9
08D2: set_object_scale $hillPlant4 to 0.7
0188: add_blip_for_object $hillPlant4 store_to $hillPlantBlip4
0165: change_blip_colour $hillPlantBlip4 to 3
018B: change_blip_display $hillPlantBlip4 to 3

mark_model_as_no_longer_needed 3409

print_string_now "MISSION III~n~Harvest the hill grow" 6000
return

:SPAWN_HILL_GUARDS
$hillGuardsSpawned = 1
request_model 108
request_model 109
request_model 110
request_model 103
request_model #COLT45

while not has_model_loaded 108
    wait 0
end
while not has_model_loaded 109
    wait 0
end
while not has_model_loaded 110
    wait 0
end
while not has_model_loaded 103
    wait 0
end
while not has_model_loaded #COLT45
    wait 0
end

$hillGuard1 = create_char 4 108 at 2445.8552 -950.2800 80.283
set_char_heading $hillGuard1 180.0
01B2: give_actor $hillGuard1 weapon 22 ammo 150
02E2: set_actor $hillGuard1 weapon_accuracy_to 45
05E2: AS_actor $hillGuard1 kill_actor $scplayer

$hillGuard2 = create_char 4 109 at 2443.3552 -950.2800 80.283
set_char_heading $hillGuard2 210.0
01B2: give_actor $hillGuard2 weapon 22 ammo 150
02E2: set_actor $hillGuard2 weapon_accuracy_to 45
05E2: AS_actor $hillGuard2 kill_actor $scplayer

$hillGuard3 = create_char 4 103 at 2448.3552 -950.2800 80.283
set_char_heading $hillGuard3 120.0
01B2: give_actor $hillGuard3 weapon 22 ammo 150
02E2: set_actor $hillGuard3 weapon_accuracy_to 45
05E2: AS_actor $hillGuard3 kill_actor $scplayer

$hillGuard4 = create_char 4 110 at 2445.8552 -953.2800 80.283
set_char_heading $hillGuard4 90.0
01B2: give_actor $hillGuard4 weapon 22 ammo 150
02E2: set_actor $hillGuard4 weapon_accuracy_to 45
05E2: AS_actor $hillGuard4 kill_actor $scplayer

mark_model_as_no_longer_needed 108
mark_model_as_no_longer_needed 109
mark_model_as_no_longer_needed 110
mark_model_as_no_longer_needed 103
mark_model_as_no_longer_needed #COLT45

print_string_now "Vagos arrived at the grow" 3000
return

:GROWHOUSE_TYRELL_CALL
$growhouseTyrellCallDone = 1
$tyrellCallTime = nowTime
print_string_now "PHONE CALL~n~CJ calls Tyrell" 4000
wait 3000
0ACE: show_formatted_text_box "CJ: Tyrell, get to that house in the hills."
wait 3500
0ACE: show_formatted_text_box "CJ: I got a business idea, and I need Grove hands on it."
wait 4000
0ACE: show_formatted_text_box "Tyrell: Say less, CJ. I'll head there."
wait 3500
return

:START_MISSION_V
if
    $mission5Started == 0
then
    $mission5Started = 1
    $mission5CallDone = 1
    print_string_now "PHONE CALL~n~CJ calls the buyer" 4000
    wait 3000
    0ACE: show_formatted_text_box "CJ: Unc, who do I look for at the beach to get this moving?"
    wait 4000
    0ACE: show_formatted_text_box "Buyer: Find Isaac. He hustles weed around the beach."
    wait 4000
    0ACE: show_formatted_text_box "Buyer: He keeps away from crowds. Look for him somewhere secluded."
    wait 4500
    print_string_now "MISSION V~n~Find Isaac at the beach" 6000
end
return

:START_MISSION_VI
$mission6Started = 1
$mission6SoldGrams = 0
print_string_now "MISSION VI~n~Slinging" 6000
wait 3000
0ACE: show_formatted_text_box "Isaac: You CJ? Heard you got something stronger than street smoke."
wait 4000
0ACE: show_formatted_text_box "CJ: I am looking for a beach connection."
wait 3500
0ACE: show_formatted_text_box "Isaac: Then you found one. But out here, you move careful."
wait 4000
0ACE: show_formatted_text_box "Isaac: Customers drift around Santa Maria. Not too close, not too often."
wait 4500
0ACE: show_formatted_text_box "Isaac: When you spot one, walk up and press T. Keep your eyes open for cops."
wait 4500
print_string_now "OBJECTIVE~n~Sell 100g AK-47 at Santa Maria Beach" 6000
wait 3500
$slingingUnlocked = 1
$slingNextSpawn = nowTime
$slingNextSpawn += 10000
return

:SPAWN_SLING_CUSTOMER
$slingSpawnIndex += 1
if
    $slingSpawnIndex == 1
then
        $slingCustomerX = 248.0
        $slingCustomerY = -1788.0
        $slingCustomerZ = 3.2
else
    if
        $slingSpawnIndex == 2
    then
        $slingCustomerX = 263.0
        $slingCustomerY = -1802.0
        $slingCustomerZ = 3.2
    else
        if
            $slingSpawnIndex == 3
        then
            $slingCustomerX = 282.0
            $slingCustomerY = -1816.0
            $slingCustomerZ = 3.2
        else
            if
                $slingSpawnIndex == 4
            then
                $slingCustomerX = 310.0
                $slingCustomerY = -1794.0
                $slingCustomerZ = 3.4
            else
                if
                    $slingSpawnIndex == 5
                then
                    $slingCustomerX = 326.0
                    $slingCustomerY = -1828.0
                    $slingCustomerZ = 3.4
                else
                    if
                        $slingSpawnIndex == 6
                    then
                        $slingCustomerX = 222.0
                        $slingCustomerY = -1798.0
                        $slingCustomerZ = 3.1
                    else
                        $slingCustomerX = 296.0
                        $slingCustomerY = -1842.0
                        $slingCustomerZ = 3.3
                        $slingSpawnIndex = 0
                    end
                end
            end
        end
    end
end
$slingCustomerModel = 7
if
    $slingSpawnIndex == 1
then
    $slingCustomerModel = 7
else
    if
        $slingSpawnIndex == 2
    then
        $slingCustomerModel = 21
    else
        if
            $slingSpawnIndex == 3
        then
            $slingCustomerModel = 22
        else
            if
                $slingSpawnIndex == 4
            then
                $slingCustomerModel = 23
            else
                if
                    $slingSpawnIndex == 5
                then
                    $slingCustomerModel = 18
                else
                    if
                        $slingSpawnIndex == 6
                    then
                        $slingCustomerModel = 19
                    else
                        $slingCustomerModel = 45
                    end
                end
            end
        end
    end
end
request_model $slingCustomerModel
while not has_model_loaded $slingCustomerModel
    wait 0
end
$slingCustomer = create_char 4 $slingCustomerModel at $slingCustomerX $slingCustomerY $slingCustomerZ
set_char_heading $slingCustomer 90.0
wait 1500
freeze_char_position $slingCustomer True
mark_model_as_no_longer_needed $slingCustomerModel
04CE: add_short_range_sprite_blip_for_coord $slingCustomerX $slingCustomerY $slingCustomerZ sprite 52 store_to $slingCustomerBlip
03BC: add_sphere $slingCustomerX $slingCustomerY $slingCustomerZ radius 1.2 store_to $slingCustomerMarker
$slingCustomerActive = 1
$slingCustomerMenu = 0
$slingCustomerPrompt = 0
print_string_now "Potential customer spotted" 5000
return

:SPAWN_ECSTASY_DEALER
$ecstasyDealerSpawned = 1
if
    $ecstasyDealerBlip <> -1
then
    0164: remove_blip $ecstasyDealerBlip
    $ecstasyDealerBlip = -1
end
if
    $ecstasyDealerMarker <> -1
then
    03BD: destroy_sphere $ecstasyDealerMarker
    $ecstasyDealerMarker = -1
end
request_model 29
while not has_model_loaded 29
    wait 0
end
$ecstasyDealer = create_char 4 29 at 408.0 -2052.0 8.0
set_char_heading $ecstasyDealer 270.0
wait 500
freeze_char_position $ecstasyDealer True
mark_model_as_no_longer_needed 29
04CE: add_short_range_sprite_blip_for_coord 408.0 -2052.0 8.0 sprite 52 store_to $ecstasyDealerBlip
03BC: add_sphere 408.0 -2052.0 8.0 radius 1.2 store_to $ecstasyDealerMarker
print_string_now "NEW DEALER~n~Dollar marker near Santa Maria pier" 6000
return

:SPAWN_MAYA_INTRO
$mayaIntroSpawned = 1
$mayaIntroActorSpawned = 0
if
    $mayaBlip <> -1
then
    0164: remove_blip $mayaBlip
    $mayaBlip = -1
end
if
    $mayaMarker <> -1
then
    03BD: destroy_sphere $mayaMarker
    $mayaMarker = -1
end
request_model #WFYRI
while not has_model_loaded #WFYRI
    wait 0
end
$maya = create_char 4 #WFYRI at 258.5 -1809.7 3.6
set_char_heading $maya 180.0
wait 1000
freeze_char_position $maya True
$mayaIntroActorSpawned = 1
mark_model_as_no_longer_needed #WFYRI
04CE: add_short_range_sprite_blip_for_coord 258.5 -1808.5 3.2 sprite 37 store_to $mayaBlip
03BC: add_sphere 258.5 -1808.5 3.2 radius 1.2 store_to $mayaMarker
print_string_now "SPECIAL CUSTOMER~n~Someone wants to talk" 6000
return

:MAYA_INTRO_TALK
if
    $lsdTabs > 0
then
    0ACE: show_formatted_text_box "Maya: You are the one Isaac has people whispering about?"
    wait 4500
    0ACE: show_formatted_text_box "CJ: Found this tab on one of those Vagos at Hilltop."
    wait 5000
    0ACE: show_formatted_text_box "CJ: Isaac said you might know what it is worth."
    wait 4500
    0ACE: show_formatted_text_box "Maya: LSD? Then you are not just beach traffic anymore."
    wait 4500
    0ACE: show_formatted_text_box "Maya: I move with a different crowd. Night people. Club people."
    wait 5000
    0ACE: show_formatted_text_box "Maya: Ecstasy, LSD, mushrooms. Find me near Market and we talk business."
    wait 5000
    $lsdTabs -= 1
    if
        $mayaBlip <> -1
    then
        0164: remove_blip $mayaBlip
        $mayaBlip = -1
    end
    if
        $mayaMarker <> -1
    then
        03BD: destroy_sphere $mayaMarker
        $mayaMarker = -1
    end
    009B: destroy_actor $maya
    $mayaIntroActorSpawned = 0
    $mayaUnlocked = 1
    $nightlifeSlingingUnlocked = 1
    $mayaIntroSpawned = 2
    $mayaPrompt = 0
    04CE: add_short_range_sprite_blip_for_coord 1095.0 -1185.0 18.0 sprite 52 store_to $mayaBlip
    print_string_now "NEW CONTACT UNLOCKED~n~Maya" 6000
    wait 3500
    print_string_now "Nightlife slinging unlocked" 5000
else
    print_string_now "You need an LSD tab" 3000
end
return

:SPAWN_MAYA_PERMANENT
$mayaIntroSpawned = 3
request_model #WFYRI
while not has_model_loaded #WFYRI
    wait 0
end
$maya = create_char 4 #WFYRI at 1095.0 -1185.0 18.0
set_char_heading $maya 90.0
wait 1000
freeze_char_position $maya True
mark_model_as_no_longer_needed #WFYRI
if
    $mayaMarker == -1
then
    03BC: add_sphere 1093.8 -1185.0 18.0 radius 1.2 store_to $mayaMarker
end
if
    $mayaBlip == -1
then
    04CE: add_short_range_sprite_blip_for_coord 1095.0 -1185.0 18.0 sprite 52 store_to $mayaBlip
end
print_string_now "MAYA~n~Nightlife contact found" 5000
return

:MAYA_CONTACT_TALK
0ACE: show_formatted_text_box "Maya: Santa Maria taught you foot traffic. Market teaches you taste."
wait 5000
0ACE: show_formatted_text_box "Maya: Build trust here and the crowd starts asking for things Isaac's people do not touch."
wait 5500
print_string_now "Nightlife slinging - Market~n~Prototype unlocked" 5000
return

:MAYA_BUY_ECSTASY
if
    010A: is_score_greater $player1 than 59
then
    0109: add_score $player1 value -60
    $ecstasyPills += 5
    0ACE: show_formatted_text_box "Maya: Party crowd remembers bad nights. Keep it clean."
    wait 3500
    print_string_now "Bought 5 ecstasy" 3000
else
    print_string_now "You need $60" 3000
end
return

:MAYA_BUY_LSD
if
    010A: is_score_greater $player1 than 59
then
    0109: add_score $player1 value -60
    $lsdTabs += 1
    0ACE: show_formatted_text_box "Maya: One tab can open doors or close them. Choose who gets it."
    wait 4000
    print_string_now "Bought 1 LSD tab" 3000
else
    print_string_now "You need $60" 3000
end
return

:MAYA_BUY_MUSHROOMS
if
    010A: is_score_greater $player1 than 44
then
    0109: add_score $player1 value -45
    $mushroomPacks += 3
    0ACE: show_formatted_text_box "Maya: Softer crowd, slower money. Still money."
    wait 3500
    print_string_now "Bought 3 mushroom packs" 3000
else
    print_string_now "You need $45" 3000
end
return

:MAYA_SELL_COCAINE
if
    $cocaineGrams > 9
then
    $cocaineGrams -= 10
    0109: add_score $player1 value 2500
    $drugHeat += 10
    print_string_now "Sold 10g cocaine to Maya~n~+$2500" 5000
    wait 2500
    0ACE: show_formatted_text_box "Maya: This is not party money anymore. This is territory money."
    gosub @CHECK_HEAT_PRESSURE
else
    print_string_now "Need 10g cocaine" 3000
end
return

:MAYA_TOGGLE_NIGHTLIFE
if
    $nightlifeActive == 1
then
    $nightlifeActive = 0
    if
        $nightCustomerActive == 1
    then
        gosub @CLEAR_DEAD_NIGHT_CUSTOMER
    end
    print_string_now "Nightlife slinging paused" 3000
else
    $nightlifeActive = 1
    $nightNextSpawn = nowTime
    $nightNextSpawn += 8000
    if
        $mission9Started == 0
    then
        $mission9Started = 1
        $mission9Sales = 0
        print_string_now "MISSION IX~n~Nightlife Slinging" 6000
        wait 2500
        0ACE: show_formatted_text_box "Maya: Stay close. My crowd does not wander like Isaac's beach people."
        wait 4500
        0ACE: show_formatted_text_box "Maya: Five clean sales. Then the Market crowd knows your name."
        wait 4500
    else
        print_string_now "Nightlife slinging - Market" 4000
        wait 1500
        0ACE: show_formatted_text_box "Maya: Stay close. My crowd does not wander like Isaac's beach people."
    end
end
return

:SPAWN_NIGHT_CUSTOMER
$nightSpawnIndex += 1
if
    $nightSpawnIndex == 1
then
    $slingCustomerX = 1070.181
    $slingCustomerY = -1161.7348
    $slingCustomerZ = 23.8281
    $nightCustomerA = 93.0
    $nightCustomerModel = 7
else
    if
        $nightSpawnIndex == 2
    then
        $slingCustomerX = 1144.579
        $slingCustomerY = -1104.8950
        $slingCustomerZ = 25.6578
        $nightCustomerA = 265.0
        $nightCustomerModel = 21
    else
        if
            $nightSpawnIndex == 3
        then
            $slingCustomerX = 1212.4003
            $slingCustomerY = -1130.2041
            $slingCustomerZ = 24.210
            $nightCustomerA = 188.0
            $nightCustomerModel = 22
        else
            $slingCustomerX = 1136.717
            $slingCustomerY = -1306.3486
            $slingCustomerZ = 13.5863
            $nightCustomerA = 1.0
            $nightCustomerModel = 23
            $nightSpawnIndex = 0
        end
    end
end
request_model $nightCustomerModel
while not has_model_loaded $nightCustomerModel
    wait 0
end
$nightCustomer = create_char 4 $nightCustomerModel at $slingCustomerX $slingCustomerY $slingCustomerZ
set_char_heading $nightCustomer $nightCustomerA
wait 1000
freeze_char_position $nightCustomer True
mark_model_as_no_longer_needed $nightCustomerModel
04CE: add_short_range_sprite_blip_for_coord $slingCustomerX $slingCustomerY $slingCustomerZ sprite 52 store_to $nightCustomerBlip
03BC: add_sphere $slingCustomerX $slingCustomerY $slingCustomerZ radius 1.2 store_to $nightCustomerMarker
$nightCustomerActive = 1
$nightCustomerMenu = 0
$nightCustomerPrompt = 0
print_string_now "Nightlife customer spotted" 4000
return

:NIGHT_FINISH_DEAL
if
    $nightCustomerBlip <> -1
then
    0164: remove_blip $nightCustomerBlip
    $nightCustomerBlip = -1
end
if
    $nightCustomerMarker <> -1
then
    03BD: destroy_sphere $nightCustomerMarker
    $nightCustomerMarker = -1
end
009B: destroy_actor $nightCustomer
$nightCustomerActive = 0
$nightCustomerMenu = 0
$nightCustomerPrompt = 0
$nightlifeRep += 2
$drugHeat += 2
0AD1: show_formatted_text_highpriority "+2 Nightlife rep~n~Rep:%d Heat:%d" time 4000 $nightlifeRep $drugHeat
gosub @CHECK_HEAT_PRESSURE
if
    $mission9Started == 1
then
    $mission9Sales += 1
    if
        $mission9Sales > 4
    then
        $mission9Started = 2
        print_string_now "MISSION PASSED~n~Nightlife Slinging" 6000
        wait 2500
        print_string_now "Nightlife slinging - Market" 4000
    else
        0AD1: show_formatted_text_highpriority "MISSION IX~n~Sales:%d/5" time 4000 $mission9Sales
    end
end
$nightNextSpawn = nowTime
$nightNextSpawn += 12000
return

:CLEAR_DEAD_NIGHT_CUSTOMER
if
    $nightCustomerBlip <> -1
then
    0164: remove_blip $nightCustomerBlip
    $nightCustomerBlip = -1
end
if
    $nightCustomerMarker <> -1
then
    03BD: destroy_sphere $nightCustomerMarker
    $nightCustomerMarker = -1
end
009B: destroy_actor $nightCustomer
$nightCustomerActive = 0
$nightCustomerMenu = 0
$nightCustomerPrompt = 0
$nightNextSpawn = nowTime
$nightNextSpawn += 8000
return

:NIGHT_SELL_ECSTASY
if
    $ecstasyPills > 0
then
    $ecstasyPills -= 1
    $slingSalePrice = 20
    $slingSalePrice *= $nightlifeRep
    $slingSalePrice /= 100
    $slingSalePrice += 20
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold ecstasy for $%d" time 3000 $slingSalePrice
    gosub @NIGHT_FINISH_DEAL
else
    print_string_now "No ecstasy" 3000
end
return

:NIGHT_SELL_LSD
if
    $lsdTabs > 0
then
    $lsdTabs -= 1
    $slingSalePrice = 90
    $slingSalePrice *= $nightlifeRep
    $slingSalePrice /= 100
    $slingSalePrice += 90
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold LSD for $%d" time 3000 $slingSalePrice
    gosub @NIGHT_FINISH_DEAL
else
    print_string_now "No LSD" 3000
end
return

:NIGHT_SELL_MUSHROOMS
if
    $mushroomPacks > 0
then
    $mushroomPacks -= 1
    $slingSalePrice = 25
    $slingSalePrice *= $nightlifeRep
    $slingSalePrice /= 100
    $slingSalePrice += 25
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold mushrooms for $%d" time 3000 $slingSalePrice
    gosub @NIGHT_FINISH_DEAL
else
    print_string_now "No mushrooms" 3000
end
return

:NIGHT_SELL_COCAINE
if
    $cocaineGrams > 0
then
    $cocaineGrams -= 1
    $slingSalePrice = 180
    $slingSalePrice *= $nightlifeRep
    $slingSalePrice /= 100
    $slingSalePrice += 180
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold cocaine for $%d" time 3000 $slingSalePrice
    gosub @NIGHT_FINISH_DEAL
else
    print_string_now "No cocaine" 3000
end
return

:BUY_ECSTASY
if
    010A: is_score_greater $player1 than 59
then
    0109: add_score $player1 value -60
    $ecstasyPackSize = 5
    if
        $ecstasyDealerStage == 1
    then
        $ecstasyPackSize = 6
    end
    if
        $ecstasyDealerStage == 2
    then
        $ecstasyPackSize = 8
    end
    if
        $ecstasyDealerStage > 2
    then
        $ecstasyPackSize = 10
    end
    $ecstasyPills += $ecstasyPackSize
    $ecstasyDealerDeals += 1
    $slingingRepBeach += 1
    $drugHeat += 3
    0AD1: show_formatted_text_highpriority "Bought %d ecstasy~n~Dealer deals:%d~n~+1 rep +3 heat" time 5000 $ecstasyPackSize $ecstasyDealerDeals
    wait 2500
    gosub @CHECK_HEAT_PRESSURE
    if
        $ecstasyDealerDeals == 1
    then
        0ACE: show_formatted_text_box "Dealer: Keep it quiet and we both keep eating."
        wait 3500
        0ACE: show_formatted_text_box "Dealer: You want better supply, keep coming back and build level 2 standing with me."
        wait 4500
        print_string_now "DEALER STANDING~n~Build trust to level 2" 5000
    else
        if
            $ecstasyDealerDeals == 2
        then
            0ACE: show_formatted_text_box "Dealer: You move calm. I like that."
        else
            if
                $ecstasyDealerDeals == 3
            then
                0ACE: show_formatted_text_box "Dealer: Beach money spends different, CJ."
            else
                0ACE: show_formatted_text_box "Dealer: Same rules. Cash first, no names."
            end
        end
    end
    wait 2500
    gosub @CHECK_ECSTASY_RELATION
else
    print_string_now "Not enough money" 3000
end
return

:DEALER_SELL_COCAINE
if
    $cocaineGrams > 4
then
    $cocaineGrams -= 5
    0109: add_score $player1 value 1400
    $drugHeat += 6
    print_string_now "Sold 5g cocaine to dealer~n~+$1400" 5000
    wait 2500
    0ACE: show_formatted_text_box "Dealer: This is a different league. Keep my name out of it."
    gosub @CHECK_HEAT_PRESSURE
else
    print_string_now "Need 5g cocaine" 3000
end
return

:CHECK_ECSTASY_RELATION
if
    $ecstasyDealerDeals > 4
then
    if
        $ecstasyDealerStage == 0
    then
        $ecstasyDealerStage = 1
        print_string_now "DEALER RELATIONSHIP~n~Trust level 1" 5000
        wait 2500
        0ACE: show_formatted_text_box "Dealer: Five runs and no heat at my door. That means something."
        wait 3500
        0ACE: show_formatted_text_box "Dealer: From now on, I put a little extra in your bag."
        wait 3500
    end
end
if
    $ecstasyDealerDeals > 9
then
    if
        $ecstasyDealerStage == 1
    then
        $ecstasyDealerStage = 2
        print_string_now "DEALER RELATIONSHIP~n~Trust level 2" 5000
        wait 2500
        0ACE: show_formatted_text_box "Dealer: You are not just buying anymore. You are building a lane."
        wait 4000
        0ACE: show_formatted_text_box "Dealer: I can move bigger packs through you if you keep it clean."
        wait 4000
        if
            $chemistUnlocked == 0
        then
            $chemistUnlocked = 1
            0ACE: show_formatted_text_box "Dealer: I know an old chemist. Weird man, useful man."
            wait 4500
            0ACE: show_formatted_text_box "Dealer: He does not talk unless you have something worth processing."
            wait 4500
            0ACE: show_formatted_text_box "Dealer: Grow poppy, bring raw opium, and he will reach out."
            wait 4500
            print_string_now "CHEMIST CONTACT~n~Harvest opium first" 6000
        end
    end
end
if
    $ecstasyDealerDeals > 14
then
    if
        $ecstasyDealerStage == 2
    then
        $ecstasyDealerStage = 3
        print_string_now "DEALER RELATIONSHIP~n~Trusted contact" 5000
        wait 2500
        0ACE: show_formatted_text_box "Dealer: Fifteen deals. Most fools do not make it to five."
        wait 4000
        0ACE: show_formatted_text_box "Dealer: You need product, you come straight to me. No middlemen."
        wait 4000
    end
end
return

:SPAWN_BEACH_CROWD
$beachCrowdSpawned = 1
request_model 18
request_model 19
request_model 45
request_model 138
while not has_model_loaded 18
    wait 0
end
while not has_model_loaded 19
    wait 0
end
while not has_model_loaded 45
    wait 0
end
while not has_model_loaded 138
    wait 0
end
$beachPed1 = create_char 4 18 at 230.0 -1848.0 4.2
set_char_heading $beachPed1 60.0
wait 200
$beachPed2 = create_char 4 19 at 275.0 -1822.0 4.4
set_char_heading $beachPed2 180.0
wait 200
$beachPed3 = create_char 4 45 at 205.0 -1795.0 4.3
set_char_heading $beachPed3 270.0
wait 200
$beachPed4 = create_char 4 138 at 292.0 -1765.0 4.6
set_char_heading $beachPed4 120.0
wait 200
mark_model_as_no_longer_needed 18
mark_model_as_no_longer_needed 19
mark_model_as_no_longer_needed 45
mark_model_as_no_longer_needed 138
return

:CLEAR_BEACH_CROWD
009B: destroy_actor $beachPed1
009B: destroy_actor $beachPed2
009B: destroy_actor $beachPed3
009B: destroy_actor $beachPed4
$beachCrowdSpawned = 0
return

:SPAWN_TYRELL_CREW
$tyrellCrewSpawned = 1
request_model 105
request_model 107
while not has_model_loaded 105
    wait 0
end
while not has_model_loaded 107
    wait 0
end
$tyrell = create_char 4 105 at 2456.07 -951.6974 80.768
set_char_heading $tyrell 173.0
wait 2000
freeze_char_position $tyrell True
$groveWorker = create_char 4 107 at 2457.25 -951.8974 80.768
set_char_heading $groveWorker 173.0
wait 2000
freeze_char_position $groveWorker True
mark_model_as_no_longer_needed 105
mark_model_as_no_longer_needed 107
request_model 3409
while not has_model_loaded 3409
    wait 0
end
$workerAkPlant = create_object 3409 at 2450.8552 -953.2800 78.9
08D2: set_object_scale $workerAkPlant to 0.65
mark_model_as_no_longer_needed 3409
$workerAkActive = 1
$workerAkReady = 0
$workerAkStart = nowTime
print_string_now "TYRELL ARRIVED~n~Talk to him at the growhouse" 6000
return

:TYRELL_GIVE_SEED
if
    $workerSeeds > 3
then
    print_string_now "Worker grow is full~n~4/4 plants active" 3000
else
    if
        seedPacks > 0
    then
        seedPacks -= 1
        $workerSeeds += 1
        if
            $workerSeeds == 1
        then
            $workerGrowStart = nowTime
            $workerHarvestReady = 0
            $workerHarvestGrams = 0
        end
        request_model 3409
        while not has_model_loaded 3409
            wait 0
        end
        if
            $workerSeeds == 1
        then
            $hillPlant1 = create_object 3409 at 2445.8552 -950.2800 78.9
            08D2: set_object_scale $hillPlant1 to 0.55
        else
            if
                $workerSeeds == 2
            then
                $hillPlant2 = create_object 3409 at 2443.3552 -950.2800 78.9
                08D2: set_object_scale $hillPlant2 to 0.55
            else
                if
                    $workerSeeds == 3
                then
                    $hillPlant3 = create_object 3409 at 2448.3552 -950.2800 78.9
                    08D2: set_object_scale $hillPlant3 to 0.55
                else
                    $hillPlant4 = create_object 3409 at 2445.8552 -953.2800 78.9
                    08D2: set_object_scale $hillPlant4 to 0.55
                end
            end
        end
        mark_model_as_no_longer_needed 3409
        0AD1: show_formatted_text_highpriority "Tyrell planted a worker crop~n~Worker grow:%d/4" time 5000 $workerSeeds
    else
        print_string_now "You need a seed pack" 3000
    end
end
return

:TYRELL_COLLECT
if
    $workerHarvestReady == 1
then
    weedGrams += $workerHarvestGrams
    0AD1: show_formatted_text_highpriority "Collected %dg cannabis from Tyrell" time 5000 $workerHarvestGrams
    if
        $workerSeeds > 0
    then
        delete_object $hillPlant1
    end
    if
        $workerSeeds > 1
    then
        delete_object $hillPlant2
    end
    if
        $workerSeeds > 2
    then
        delete_object $hillPlant3
    end
    if
        $workerSeeds > 3
    then
        delete_object $hillPlant4
    end
    $workerSeeds = 0
    $workerHarvestReady = 0
    $workerHarvestGrams = 0
else
    print_string_now "No worker cannabis ready" 3000
end

if
    $workerAkReady == 1
then
    $akWeedGrams += 75
    print_string_now "Collected 75g AK-47 from Tyrell" 5000
    delete_object $workerAkPlant
    request_model 3409
    while not has_model_loaded 3409
        wait 0
    end
    $workerAkPlant = create_object 3409 at 2450.8552 -953.2800 78.9
    08D2: set_object_scale $workerAkPlant to 0.65
    mark_model_as_no_longer_needed 3409
    $workerAkReady = 0
    $workerAkStart = nowTime
end
return

:BUY_GROWHOUSE_SECURITY
if
    $growhouseSecurityBought == 0
then
    if
        010A: is_score_greater $player1 than 2499
    then
        0109: add_score $player1 value -2500
        $growhouseSecurityBought = 1
        print_string_now "GROWHOUSE SECURITY~n~Grove guard assigned" 5000
        wait 2500
        0ACE: show_formatted_text_box "Tyrell: I put a Grove soldier on the plants."
        wait 3500
        0ACE: show_formatted_text_box "Tyrell: Anybody comes up that hill wrong, he handles it."
        wait 3500
        gosub @SPAWN_GROWHOUSE_SECURITY
    else
        print_string_now "You need $2500" 3000
    end
else
    print_string_now "Security already upgraded" 3000
end
return

:SPAWN_GROWHOUSE_SECURITY
$growhouseSecuritySpawned = 1
request_model 106
while not has_model_loaded 106
    wait 0
end
$growhouseSecurityGuard = create_char 4 106 at 2447.7 -950.8 80.283
set_char_heading $growhouseSecurityGuard 180.0
01B2: give_actor $growhouseSecurityGuard weapon 30 ammo 500
02E2: set_actor $growhouseSecurityGuard weapon_accuracy_to 55
wait 500
freeze_char_position $growhouseSecurityGuard True
mark_model_as_no_longer_needed 106
return

:SLING_FINISH_DEAL
if
    $slingCustomerBlip <> -1
then
    0164: remove_blip $slingCustomerBlip
    $slingCustomerBlip = -1
end
if
    $slingCustomerMarker <> -1
then
    03BD: destroy_sphere $slingCustomerMarker
    $slingCustomerMarker = -1
end
freeze_char_position $slingCustomer False
009B: destroy_actor $slingCustomer
$slingCustomerActive = 0
$slingCustomerMenu = 0
$slingCustomerPrompt = 0
$slingingRepBeach += 2
$slingDeals += 1
$slingDealsSinceHeat += 1
if
    $slingDeals > 4
then
    if
        $ecstasyDealerSpawned == 0
    then
        gosub @SPAWN_ECSTASY_DEALER
        wait 1500
        print_string_now "DEALER CONTACT~n~Ecstasy source marked" 5000
        wait 1500
    end
end
if
    $slingDealsSinceHeat > 9
then
    $slingDealsSinceHeat = 0
    $drugHeat += 25
    0AD1: show_formatted_text_highpriority "+25 HEAT~n~10 street deals completed~n~Heat:%d" time 5000 $drugHeat
    wait 2500
    gosub @CHECK_HEAT_PRESSURE
end
$slingThanks += 1
if
    $slingThanks == 1
then
    0ACE: show_formatted_text_box "Customer: Good looking out."
else
    if
        $slingThanks == 2
    then
        0ACE: show_formatted_text_box "Customer: I'll remember this."
    else
        0ACE: show_formatted_text_box "Customer: That's exactly what I needed."
        $slingThanks = 0
    end
end
wait 2500
0AD1: show_formatted_text_highpriority "+2 Reputation - Santa Maria Beach~n~Rep:%d Deals:%d" time 5000 $slingingRepBeach $slingDeals
if
    $mission6Started == 1
then
    if
        $mission6SoldGrams > 99
    then
        $mission6Started = 2
        print_string_now "MISSION PASSED~n~Slinging" 6000
        wait 3500
        print_string_now "Slinging - Santa Maria Beach" 5000
        wait 2500
        gosub @START_MISSION_VII
    else
        0AD1: show_formatted_text_highpriority "MISSION VI~n~AK sold:%dg/100g" time 4000 $mission6SoldGrams
        wait 1500
    end
end
$slingNextSpawn = nowTime
$slingNextSpawn += 25000
return

:CLEAR_DEAD_SLING_CUSTOMER
if
    $slingCustomerBlip <> -1
then
    0164: remove_blip $slingCustomerBlip
    $slingCustomerBlip = -1
end
if
    $slingCustomerMarker <> -1
then
    03BD: destroy_sphere $slingCustomerMarker
    $slingCustomerMarker = -1
end
009B: destroy_actor $slingCustomer
$slingCustomerActive = 0
$slingCustomerMenu = 0
$slingCustomerPrompt = 0
$slingNextSpawn = nowTime
$slingNextSpawn += 8000
print_string_now "Customer lost~n~Looking for another" 3000
return

:START_MISSION_VII
if
    $mission7Started == 0
then
    $mission7Started = 1
    print_string_now "PHONE CALL~n~Supplier" 4000
    wait 3000
    0ACE: show_formatted_text_box "Supplier: CJ, I got something different coming in."
    wait 4000
    0ACE: show_formatted_text_box "Supplier: Poppy seeds. Riskier, but the money can move fast."
    wait 4000
    0ACE: show_formatted_text_box "Supplier: Come by and I will sell you three to start."
    wait 4000
    print_string_now "MISSION VII~n~Buy 3 poppy seeds from the supplier" 7000
end
return

:START_MISSION_VIII
$mission8Started = 1
print_string_now "PHONE CALL~n~Tyrell" 4000
wait 3000
0ACE: show_formatted_text_box "Tyrell: CJ, that hill house is doing work, but it is too small."
wait 4500
0ACE: show_formatted_text_box "Tyrell: If you are moving Morgan product, you need dirt. Real dirt."
wait 4500
0ACE: show_formatted_text_box "Tyrell: I heard about Hilltop Farm. Vagos been using it as a stash route."
wait 5000
0ACE: show_formatted_text_box "Tyrell: They are growing poppy out there. Clear them out and the dirt is ours."
wait 4500
04CE: add_short_range_sprite_blip_for_coord 1044.4471 -332.1785 73.9850 sprite 37 store_to $farmBlip
print_string_now "MISSION VIII~n~Bad Soil" 6000
wait 3000
print_string_now "OBJECTIVE~n~Clear Hilltop Farm" 6000
return

:SPAWN_FARM_GUARDS
$farmGuardsSpawned = 1
request_model 108
request_model 109
request_model 110
request_model #COLT45
while not has_model_loaded 108
    wait 0
end
while not has_model_loaded 109
    wait 0
end
while not has_model_loaded 110
    wait 0
end
while not has_model_loaded #COLT45
    wait 0
end
$farmGuard1 = create_char 4 108 at 1041.5 -329.8 73.9850
set_char_heading $farmGuard1 220.0
01B2: give_actor $farmGuard1 weapon 22 ammo 150
02E2: set_actor $farmGuard1 weapon_accuracy_to 45
05E2: AS_actor $farmGuard1 kill_actor $scplayer
$farmGuard2 = create_char 4 109 at 1048.0 -331.5 73.9850
set_char_heading $farmGuard2 180.0
01B2: give_actor $farmGuard2 weapon 22 ammo 150
02E2: set_actor $farmGuard2 weapon_accuracy_to 45
05E2: AS_actor $farmGuard2 kill_actor $scplayer
$farmGuard3 = create_char 4 110 at 1044.0 -337.2 73.9850
set_char_heading $farmGuard3 90.0
01B2: give_actor $farmGuard3 weapon 22 ammo 150
02E2: set_actor $farmGuard3 weapon_accuracy_to 45
05E2: AS_actor $farmGuard3 kill_actor $scplayer
request_model 870
while not has_model_loaded 870
    wait 0
end
$farmPoppyPlant = create_object 870 at 1044.4471 -332.1785 72.9850
08D2: set_object_scale $farmPoppyPlant to 0.45
$farmPoppyPlant2 = create_object 870 at 1044.4471 -334.1785 72.9850
08D2: set_object_scale $farmPoppyPlant2 to 0.45
$farmPoppyPlant3 = create_object 870 at 1044.4471 -336.1785 72.9850
08D2: set_object_scale $farmPoppyPlant3 to 0.45
$farmPoppyPlant4 = create_object 870 at 1044.4471 -338.1785 72.9850
08D2: set_object_scale $farmPoppyPlant4 to 0.45
mark_model_as_no_longer_needed 108
mark_model_as_no_longer_needed 109
mark_model_as_no_longer_needed 110
mark_model_as_no_longer_needed #COLT45
mark_model_as_no_longer_needed 870
print_string_now "VAGOS FARM~n~Hilltop Farm marked" 4000
return

:BUY_RED_COUNTY_FARM
if
    $farmOwned == 0
then
    if
        010A: is_score_greater $player1 than 999
    then
        0109: add_score $player1 value -1000
        $farmOwned = 1
        $mission8Complete = 1
        $farmPrompt = 0
        delete_object $farmPoppyPlant
        delete_object $farmPoppyPlant2
        delete_object $farmPoppyPlant3
        delete_object $farmPoppyPlant4
        if
            $farmMarker <> -1
        then
            03BD: destroy_sphere $farmMarker
            $farmMarker = -1
        end
        if
            $farmBlip <> -1
        then
            0164: remove_blip $farmBlip
            $farmBlip = -1
        end
        04CE: add_short_range_sprite_blip_for_coord 1044.4471 -332.1785 73.9850 sprite 52 store_to $farmBlip
        print_string_now "MISSION PASSED~n~Bad Soil" 7000
        wait 3500
        if
            $lsdTabs == 0
        then
            $lsdTabs += 1
        end
        0ACE: show_formatted_text_box "CJ: One of those Vagos had a tab of LSD on him."
        wait 4500
        0ACE: show_formatted_text_box "CJ: I'll see what kind of door this opens."
        wait 4500
        0ACE: show_formatted_text_box "Tyrell: Now we got room. Grove can grow something bigger out here."
        wait 4500
        0ACE: show_formatted_text_box "Tyrell: Give me time and this farm becomes the backbone."
        wait 4500
        gosub @SPAWN_FARM_CREW
    else
        print_string_now "You need $1000" 3000
    end
else
    print_string_now "Farm already owned" 3000
end
return

:SPAWN_FARM_CREW
if
    $farmCrewSpawned == 0
then
    $farmCrewSpawned = 1
    request_model 105
    request_model 107
    request_model 870
    request_model 3409
    while not has_model_loaded 105
        wait 0
    end
    while not has_model_loaded 107
        wait 0
    end
    while not has_model_loaded 870
        wait 0
    end
    while not has_model_loaded 3409
        wait 0
    end
    $farmWorker1 = create_char 4 105 at 1041.8 -329.2 73.9850
    set_char_heading $farmWorker1 160.0
    wait 1200
    freeze_char_position $farmWorker1 True
    $farmWorker2 = create_char 4 107 at 1039.8 -329.0 73.9850
    set_char_heading $farmWorker2 160.0
    wait 1200
    freeze_char_position $farmWorker2 True
    $farmPoppyPlant = create_object 870 at 1044.4471 -332.1785 72.9850
    08D2: set_object_scale $farmPoppyPlant to 0.45
    $farmPoppyPlant2 = create_object 870 at 1044.4471 -334.1785 72.9850
    08D2: set_object_scale $farmPoppyPlant2 to 0.45
    $farmPoppyPlant3 = create_object 870 at 1044.4471 -336.1785 72.9850
    08D2: set_object_scale $farmPoppyPlant3 to 0.45
    $farmPoppyPlant4 = create_object 870 at 1044.4471 -338.1785 72.9850
    08D2: set_object_scale $farmPoppyPlant4 to 0.45
    $farmAkPlant = create_object 3409 at 1042.2 -336.0 72.9850
    08D2: set_object_scale $farmAkPlant to 0.75
    mark_model_as_no_longer_needed 105
    mark_model_as_no_longer_needed 107
    mark_model_as_no_longer_needed 870
    mark_model_as_no_longer_needed 3409
    $farmPoppySeeds = 1
    $farmAkSeeds = 1
    if
        $cocaineBreakthroughDone == 1
    then
        gosub @FARM_START_COCA_AUTO
    end
    $farmHarvestReady = 0
    $farmGrowStart = nowTime
    print_string_now "HILLTOP CREW~n~Talk to the Grove worker" 6000
end
return

:FARM_START_COCA_AUTO
if
    $farmCocaAutoStarted == 0
then
    $farmCocaAutoStarted = 1
    $farmCocaSeeds = 1
    request_model #GENVEG_BUSH17
    while not has_model_loaded #GENVEG_BUSH17
        wait 0
    end
    $farmCocaPlant = create_object #GENVEG_BUSH17 at 1048.6 -331.3 72.60
    08D2: set_object_scale $farmCocaPlant to 0.80
    mark_model_as_no_longer_needed #GENVEG_BUSH17
    print_string_now "HILLTOP FARM~n~Coca row started" 5000
end
return

:FARM_GIVE_AK_SEED
if
    $farmHarvestReady == 1
then
    print_string_now "Collect current harvest first" 3000
else
    if
        $farmAkSeeds > 3
    then
        print_string_now "AK-47 farm row is full" 3000
    else
        if
            $akSeedPacks > 0
        then
            $akSeedPacks -= 1
            $farmAkSeeds += 1
            request_model 3409
            while not has_model_loaded 3409
                wait 0
            end
            if
                $farmAkSeeds == 2
            then
                $farmAkPlant2 = create_object 3409 at 1042.2 -338.0 72.9850
                08D2: set_object_scale $farmAkPlant2 to 0.75
            end
            if
                $farmAkSeeds == 3
            then
                $farmAkPlant3 = create_object 3409 at 1042.2 -340.0 72.9850
                08D2: set_object_scale $farmAkPlant3 to 0.75
            end
            if
                $farmAkSeeds == 4
            then
                $farmAkPlant4 = create_object 3409 at 1042.2 -342.0 72.9850
                08D2: set_object_scale $farmAkPlant4 to 0.75
            end
            mark_model_as_no_longer_needed 3409
            if
                $farmGrowStart == 0
            then
                $farmGrowStart = nowTime
            end
            0AD1: show_formatted_text_highpriority "Hilltop AK-47 rows:%d/4" time 4000 $farmAkSeeds
        else
            print_string_now "You need AK-47 seeds" 3000
        end
    end
end
return

:FARM_GIVE_POPPY_SEED
if
    $farmHarvestReady == 1
then
    print_string_now "Collect current harvest first" 3000
else
    if
        $farmPoppySeeds > 3
    then
        print_string_now "Poppy farm row is full" 3000
    else
        if
            $poppySeeds > 0
        then
            $poppySeeds -= 1
            $farmPoppySeeds += 1
            if
                $farmGrowStart == 0
            then
                $farmGrowStart = nowTime
            end
            0AD1: show_formatted_text_highpriority "Hilltop poppy rows:%d/4" time 4000 $farmPoppySeeds
        else
            print_string_now "You need poppy seeds" 3000
        end
    end
end
return

:FARM_GIVE_COCA_SEED
if
    $mexicanContactTalked == 0
then
    print_string_now "Coca rows locked" 3000
else
    if
        $farmHarvestReady == 1
    then
        print_string_now "Collect current harvest first" 3000
    else
        if
            $farmCocaSeeds > 3
        then
            print_string_now "Coca farm row is full" 3000
        else
            if
                $cocaSeeds > 0
            then
                $cocaSeeds -= 1
                request_model #GENVEG_BUSH17
                while not has_model_loaded #GENVEG_BUSH17
                    wait 0
                end
                if
                    $farmCocaAutoStarted == 0
                then
                    gosub @FARM_START_COCA_AUTO
                end
                $farmCocaSeeds += 1
                if
                    $farmCocaSeeds == 2
                then
                    $farmCocaPlant2 = create_object #GENVEG_BUSH17 at 1048.6 -333.3 72.60
                    08D2: set_object_scale $farmCocaPlant2 to 0.80
                end
                if
                    $farmCocaSeeds == 3
                then
                    $farmCocaPlant3 = create_object #GENVEG_BUSH17 at 1048.6 -335.3 72.60
                    08D2: set_object_scale $farmCocaPlant3 to 0.80
                end
                if
                    $farmCocaSeeds == 4
                then
                    $farmCocaPlant4 = create_object #GENVEG_BUSH17 at 1048.6 -337.3 72.60
                    08D2: set_object_scale $farmCocaPlant4 to 0.80
                end
                mark_model_as_no_longer_needed #GENVEG_BUSH17
                0AD1: show_formatted_text_highpriority "Hilltop coca rows:%d/4" time 4000 $farmCocaSeeds
            else
                print_string_now "You need coca seeds" 3000
            end
        end
    end
end
return

:FARM_COLLECT
if
    $farmHarvestReady == 1
then
    $akWeedGrams += $farmAkReadyGrams
    $opiumGrams += $farmOpiumReady
    $cocaLeaves += $farmCocaLeavesReady
    $cocaSeeds += $farmCocaSeedsReady
    0AD1: show_formatted_text_highpriority "Hilltop collected~n~AK:%dg Opium:%dg Coca:%dg~n~Coca seeds:+%d" time 6000 $farmAkReadyGrams $farmOpiumReady $farmCocaLeavesReady $farmCocaSeedsReady
    if
        $farmAkSeeds > 1
    then
        delete_object $farmAkPlant2
    end
    if
        $farmAkSeeds > 2
    then
        delete_object $farmAkPlant3
    end
    if
        $farmAkSeeds > 3
    then
        delete_object $farmAkPlant4
    end
    if
        $farmCocaSeeds > 1
    then
        delete_object $farmCocaPlant2
    end
    if
        $farmCocaSeeds > 2
    then
        delete_object $farmCocaPlant3
    end
    if
        $farmCocaSeeds > 3
    then
        delete_object $farmCocaPlant4
    end
    $farmAkSeeds = 1
    $farmPoppySeeds = 1
    if
        $farmCocaAutoStarted == 1
    then
        $farmCocaSeeds = 1
    else
        $farmCocaSeeds = 0
    end
    $farmHarvestReady = 0
    $farmAkReadyGrams = 0
    $farmOpiumReady = 0
    $farmCocaLeavesReady = 0
    $farmCocaSeedsReady = 0
    $farmGrowStart = nowTime
else
    print_string_now "Hilltop harvest not ready" 3000
end
return

:BUY_MORGAN_FARM_UPGRADE
if
    $morganFarmUpgradeBought == 0
then
    if
        $farmOwned == 1
    then
        if
            010A: is_score_greater $player1 than 2999
        then
            0109: add_score $player1 value -3000
            $morganFarmUpgradeBought = 1
            print_string_now "MISSION UNLOCKED~n~Better Call Morgan" 6000
            wait 3000
            print_string_now "PHONE CALL~n~CJ calls Morgan" 4000
            wait 3000
            0ACE: show_formatted_text_box "CJ: Morgan, I got land now. Quiet land."
            wait 4000
            0ACE: show_formatted_text_box "CJ: I know the business, and you know the chemistry."
            wait 4500
            0ACE: show_formatted_text_box "Morgan: Quiet is useful. Dirt is useful. Distance from police is priceless."
            wait 5000
            0ACE: show_formatted_text_box "Morgan: Chemistry is just patience with consequences."
            wait 4500
            0ACE: show_formatted_text_box "Morgan: Clear a corner at the farm. I will bring my tables."
            wait 4500
            gosub @SPAWN_MORGAN_FARM_LAB
        else
            print_string_now "You need $3000" 3000
        end
    else
        print_string_now "Buy Hilltop Farm first" 3000
    end
else
    print_string_now "Morgan lab already unlocked" 3000
end
return

:SPAWN_MORGAN_FARM_LAB
if
    $morganFarmMoved == 0
then
    $morganFarmMoved = 1
    if
        $chemistMarker <> -1
    then
        03BD: destroy_sphere $chemistMarker
        $chemistMarker = -1
    end
    if
        $chemistQuestionBlip <> -1
    then
        0164: remove_blip $chemistQuestionBlip
        $chemistQuestionBlip = -1
    end
    if
        $chemistBlip <> -1
    then
        0164: remove_blip $chemistBlip
        $chemistBlip = -1
    end
    if
        $chemistSpawned == 1
    then
        009B: destroy_actor $chemist
        $chemistSpawned = 0
    end
    request_model 70
    request_model 3383
    request_model 1575
    while not has_model_loaded 70
        wait 0
    end
    while not has_model_loaded 3383
        wait 0
    end
    while not has_model_loaded 1575
        wait 0
    end
    $chemist = create_char 4 70 at 1038.8 -326.5 73.9850
    set_char_heading $chemist 160.0
    wait 1000
    freeze_char_position $chemist True
    $chemistSpawned = 1
    $labTable = create_object 3383 at 1037.8 -325.6 73.0
    08D2: set_object_scale $labTable to 0.7
    $labPack1 = create_object 1575 at 1037.6 -325.2 73.54
    08D2: set_object_scale $labPack1 to 0.55
    $labPack2 = create_object 1575 at 1038.0 -325.0 73.54
    08D2: set_object_scale $labPack2 to 0.55
    mark_model_as_no_longer_needed 70
    mark_model_as_no_longer_needed 3383
    mark_model_as_no_longer_needed 1575
    04CE: add_short_range_sprite_blip_for_coord 1038.8 -326.5 73.9850 sprite 52 store_to $chemistBlip
    03BC: add_sphere 1037.8 -326.0 73.9850 radius 1.2 store_to $chemistMarker
    print_string_now "MORGAN MOVED~n~Farm lab active" 6000
end
return

:MORGAN_PROCESS_OPIUM
if
    $opiumGrams > 0
then
    0ACE: show_formatted_text_box "Morgan: Bring enough raw material and the lab starts paying for itself."
    wait 4500
    $rewardRoll = $opiumGrams
    $rewardRoll *= 2
    $heroinGrams += $rewardRoll
    $morganProcessDeals += 1
    0AD1: show_formatted_text_highpriority "Farm lab processed %dg heroin" time 5000 $rewardRoll
    $opiumGrams = 0
    if
        $morganProcessDeals == 2
    then
        $morganLsdReady += 3
        print_string_now "MORGAN LAB~n~3 LSD tabs ready" 5000
    end
    if
        $morganProcessDeals == 4
    then
        $morganLsdReady += 5
        print_string_now "MORGAN LAB~n~5 LSD tabs ready" 5000
    end
else
    print_string_now "Bring opium to process" 3000
end
return

:MORGAN_BUY_LSD
if
    010A: is_score_greater $player1 than 59
then
    0109: add_score $player1 value -60
    $lsdTabs += 1
    0ACE: show_formatted_text_box "Morgan: One tab. Do not confuse small with harmless."
    wait 3500
    print_string_now "Bought 1 LSD tab" 3000
else
    print_string_now "You need $60" 3000
end
return

:MORGAN_COLLECT_LSD
if
    $morganLsdReady > 0
then
    $lsdTabs += $morganLsdReady
    0AD1: show_formatted_text_highpriority "Collected %d LSD tabs from Morgan" time 5000 $morganLsdReady
    $morganLsdReady = 0
else
    print_string_now "No LSD ready" 3000
end
return

:MORGAN_REFINE_COCA
if
    $cocaLeaves > 0
then
    $rewardRoll = $cocaLeaves
    $rewardRoll *= 2
    $cocaineGrams += $rewardRoll
    $cocaLeaves = 0
    if
        $cocaineBreakthroughDone == 0
    then
        $cocaineBreakthroughDone = 1
        print_string_now "BREAKTHROUGH~n~Cocaine refined" 6000
        wait 3000
        0ACE: show_formatted_text_box "Morgan: That leaf is not a plant anymore. It is leverage."
        wait 4500
        0ACE: show_formatted_text_box "CJ: So this is the next level?"
        wait 3500
        0ACE: show_formatted_text_box "Morgan: This is where product becomes power."
        wait 4500
    end
    0AD1: show_formatted_text_highpriority "Refined %dg cocaine" time 5000 $rewardRoll
else
    print_string_now "Bring coca leaves" 3000
end
return

:START_HEROIN_SMUGGLE
if
    $smuggleActive == 0
then
    if
        $drugHeat > 99
    then
        print_string_now "HEAT TOO HIGH~n~Pay a bribe before smuggling" 5000
    else
        if
            $mayaUnlocked == 1
        then
            if
                $heroinGrams > 19
            then
                $farmWorkerMenu = 0
                $heroinGrams -= 20
                $smuggleLoad = 20
                $smuggleActive = 1
                $smuggleRoute = 1
                $smuggleStage = 1
                $smugglePrompt = 0
                request_model 414
                while not has_model_loaded 414
                    wait 0
                end
                $smuggleTruck = create_car 414 at 1048.5 -327.0 73.9850
                mark_model_as_no_longer_needed 414
                04CE: add_short_range_sprite_blip_for_coord 1097.2 -1185.0 18.0 sprite 52 store_to $smuggleBlip
                03BC: add_sphere 1097.2 -1185.0 18.0 radius 1.6 store_to $smuggleMarker
                print_string_now "SMUGGLING~n~Deliver 20g heroin to Maya" 6000
                wait 2500
                0ACE: show_formatted_text_box "Farm crew: Truck is out front. Twenty grams packed clean."
                wait 4000
                0ACE: show_formatted_text_box "Farm crew: Maya can move product through Market. Drive careful and unload at the dollar marker."
            else
                print_string_now "Need 20g heroin" 3000
            end
        else
            print_string_now "Unlock Maya first" 3000
        end
    end
else
    print_string_now "Smuggling already active" 3000
end
return

:FINISH_HEROIN_SMUGGLE
$smuggleActive = 0
$smuggleRoute = 0
$smuggleStage = 0
$smugglePrompt = 0
if
    $smuggleBlip <> -1
then
    0164: remove_blip $smuggleBlip
    $smuggleBlip = -1
end
if
    $smuggleMarker <> -1
then
    03BD: destroy_sphere $smuggleMarker
    $smuggleMarker = -1
end
0109: add_score $player1 value 7000
$nightlifeRep += 5
$drugHeat += 8
print_string_now "SMUGGLING COMPLETE~n~Heroin delivered" 6000
gosub @CHECK_HEAT_PRESSURE
wait 2500
0ACE: show_formatted_text_box "Maya: That is the difference between selling product and moving weight."
wait 4500
0ACE: show_formatted_text_box "Maya: Keep the route quiet and this becomes more than hand-to-hand money."
wait 4000
print_string_now "+$7000~n~+5 Nightlife rep  +8 Heat" 5000
return

:START_EMPIRE_SMUGGLE
if
    $smuggleActive == 0
then
    if
        $drugHeat > 99
    then
        print_string_now "HEAT TOO HIGH~n~Pay a bribe before empire routes" 5000
    else
        if
            $mayaUnlocked == 1
        then
            if
                $isaacDiscovered == 1
            then
                if
                    $growhouseOwned == 1
                then
                    if
                        $heroinGrams > 19
                    then
                        if
                            weedGrams > 49
                        then
                            $farmWorkerMenu = 0
                            $heroinGrams -= 20
                            $smuggleLoad = 20
                            $smuggleActive = 1
                            $smuggleRoute = 2
                            $smuggleStage = 1
                            $smugglePrompt = 0
                            request_model 414
                            while not has_model_loaded 414
                                wait 0
                            end
                            $smuggleTruck = create_car 414 at 1048.5 -327.0 73.9850
                            mark_model_as_no_longer_needed 414
                            04CE: add_short_range_sprite_blip_for_coord 2450.5 -949.8 80.690 sprite 52 store_to $smuggleBlip
                            03BC: add_sphere 2450.5 -949.8 80.690 radius 1.6 store_to $smuggleMarker
                            print_string_now "EMPIRE ROUTE~n~Drive to the growhouse" 6000
                            wait 2500
                            0ACE: show_formatted_text_box "Hilltop crew: This is bigger than one drop. Farm product first, Grove product second."
                            wait 4500
                            0ACE: show_formatted_text_box "Hilltop crew: Stop at the growhouse, load weed, then move through Maya and Isaac."
                        else
                            print_string_now "Need 50g weed for growhouse pickup" 3000
                        end
                    else
                        print_string_now "Need 20g heroin" 3000
                    end
                else
                    print_string_now "Buy growhouse first" 3000
                end
            else
                print_string_now "Find Isaac first" 3000
            end
        else
            print_string_now "Unlock Maya first" 3000
        end
    end
else
    print_string_now "Smuggling already active" 3000
end
return

:EMPIRE_PICKUP_GROWHOUSE
if
    weedGrams > 49
then
    weedGrams -= 50
    $smuggleLoad += 50
    if
        $smuggleMarker <> -1
    then
        03BD: destroy_sphere $smuggleMarker
        $smuggleMarker = -1
    end
    if
        $smuggleBlip <> -1
    then
        0164: remove_blip $smuggleBlip
        $smuggleBlip = -1
    end
    $smuggleStage = 2
    $smugglePrompt = 0
    04CE: add_short_range_sprite_blip_for_coord 1097.2 -1185.0 18.0 sprite 52 store_to $smuggleBlip
    03BC: add_sphere 1097.2 -1185.0 18.0 radius 1.6 store_to $smuggleMarker
    print_string_now "GROWHOUSE LOADED~n~Deliver to Maya" 5000
    wait 2500
    0ACE: show_formatted_text_box "Tyrell: That is Grove product in the truck. Maya gets the hard package first."
else
    print_string_now "Need 50g weed" 3000
end
return

:EMPIRE_DELIVER_MAYA
if
    $smuggleMarker <> -1
then
    03BD: destroy_sphere $smuggleMarker
    $smuggleMarker = -1
end
if
    $smuggleBlip <> -1
then
    0164: remove_blip $smuggleBlip
    $smuggleBlip = -1
end
$smuggleStage = 3
$smugglePrompt = 0
04CE: add_short_range_sprite_blip_for_coord 368.8 -2045.2 8.6 sprite 52 store_to $smuggleBlip
03BC: add_sphere 368.8 -2045.2 8.6 radius 1.6 store_to $smuggleMarker
print_string_now "MAYA DROP COMPLETE~n~Deliver Grove product to Isaac" 6000
wait 2500
0ACE: show_formatted_text_box "Maya: Farm, Grove, beach. Now you are connecting districts, CJ."
return

:FINISH_EMPIRE_SMUGGLE
$smuggleActive = 0
$smuggleRoute = 0
$smuggleStage = 0
$smugglePrompt = 0
if
    $smuggleBlip <> -1
then
    0164: remove_blip $smuggleBlip
    $smuggleBlip = -1
end
if
    $smuggleMarker <> -1
then
    03BD: destroy_sphere $smuggleMarker
    $smuggleMarker = -1
end
0109: add_score $player1 value 18000
$nightlifeRep += 10
$slingingRepBeach += 10
$drugHeat += 18
$empirePhaseUnlocked = 1
print_string_now "EMPIRE ROUTE COMPLETE~n~+$18000" 6000
gosub @CHECK_HEAT_PRESSURE
wait 3000
0ACE: show_formatted_text_box "Isaac: This ain't hustling anymore. This is supply."
wait 4000
0ACE: show_formatted_text_box "CJ: Farm to Grove, Grove to Market, Market to the beach. We got a line now."
wait 4500
print_string_now "EMPIRE PHASE UNLOCKED" 7000
wait 3500
gosub @START_MEXICAN_CONTACT
return

:START_MEXICAN_CONTACT
if
    $empireSupplierCallDone == 0
then
    $empireSupplierCallDone = 1
    print_string_now "PHONE CALL~n~Supplier" 4000
    wait 2500
    0ACE: show_formatted_text_box "Supplier: CJ, listen. A Mexican friend of mine is leaving Los Santos tonight."
    wait 5000
    0ACE: show_formatted_text_box "Supplier: Police are leaning on him hard. He has something strange with him."
    wait 5000
    0ACE: show_formatted_text_box "Supplier: Find him near Unity Station before he disappears. Whatever he gives you, keep it quiet."
    wait 5000
    gosub @SPAWN_MEXICAN_CONTACT
end
return

:SPAWN_MEXICAN_CONTACT
if
    $mexicanContactSpawned == 0
then
    $mexicanContactSpawned = 1
    $mexicanContactActorSpawned = 0
    04CE: add_short_range_sprite_blip_for_coord 1692.0 -1955.0 13.5 sprite 37 store_to $mexicanBlip
    03BC: add_sphere 1692.0 -1955.0 13.5 radius 1.2 store_to $mexicanMarker
    print_string_now "NEW LEAD~n~Mystery contact marked" 6000
end
return

:SPAWN_MEXICAN_CONTACT_ACTOR
if
    $mexicanContactActorSpawned == 0
then
    $mexicanContactActorSpawned = 1
    request_model #HMYDRUG
    while not has_model_loaded #HMYDRUG
        wait 0
    end
    $mexicanContact = create_char 4 #HMYDRUG at 1692.0 -1955.0 13.5
    set_char_heading $mexicanContact 90.0
    wait 800
    freeze_char_position $mexicanContact True
    mark_model_as_no_longer_needed #HMYDRUG
end
return

:MEXICAN_CONTACT_TALK
$mexicanContactTalked = 1
$mexicanPrompt = 0
0ACE: show_formatted_text_box "Mexican: I do not know you, and that is why this might work."
wait 4500
0ACE: show_formatted_text_box "CJ: Supplier said you had something for me."
wait 4000
0ACE: show_formatted_text_box "Mexican: One seed. Do not ask the name. Plant it somewhere quiet."
wait 5000
0ACE: show_formatted_text_box "Mexican: If it grows, you will know why people are chasing me."
wait 4500
$mysterySeeds += 1
print_string_now "MYSTERY SEED ACQUIRED~n~Press TAB+K to plant" 6000
if
    $mexicanBlip <> -1
then
    0164: remove_blip $mexicanBlip
    $mexicanBlip = -1
end
if
    $mexicanMarker <> -1
then
    03BD: destroy_sphere $mexicanMarker
    $mexicanMarker = -1
end
freeze_char_position $mexicanContact False
return

:PLANT_POPPY
if
    $poppyPlanted == 0
then
    if
        $poppySeeds > 0
    then
        $poppySeeds -= 1
        04ED: load_animation "BOMBER"
        wait 500
        0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 7000
        wait 7000
        04EF: release_animation "BOMBER"
        04C4: get_offset_from_char_in_world_coords $scplayer offset 0.0 1.0 0.0 store_to $poppyX $poppyY $poppyZ
        $poppyZ -= 1.1
        request_model 870
        while not has_model_loaded 870
            wait 0
        end
        $poppyPlant = create_object 870 at $poppyX $poppyY $poppyZ
        08D2: set_object_scale $poppyPlant to 0.12
        mark_model_as_no_longer_needed 870
        $poppyPlanted = 1
        $poppyReady = 0
        $poppyStage = 1
        $poppyStart = nowTime
        print_string_now "Poppy planted" 4000
    else
        print_string_now "You have no poppy seeds" 3000
    end
else
    print_string_now "You already have poppy growing" 3000
end
return

:HARVEST_POPPY
04ED: load_animation "BOMBER"
wait 500
0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 7000
wait 7000
04EF: release_animation "BOMBER"
if
    $poppyBlip <> -1
then
    0164: remove_blip $poppyBlip
    $poppyBlip = -1
end
delete_object $poppyPlant
$opiumGrams += 40
$poppyPlanted = 0
$poppyReady = 0
$poppyStage = 0
$poppyPrompt = 0
print_string_now "Harvested 40g opium" 5000
if
    $chemistCallDone == 0
then
    $chemistUnlocked = 1
    print_string_now "PHONE CALL~n~CJ calls the chemist" 4000
    wait 3000
    0ACE: show_formatted_text_box "CJ: I heard you know what to do with raw opium."
    wait 4000
    0ACE: show_formatted_text_box "Chemist: I know what people should not ask me about on a phone."
    wait 4500
    0ACE: show_formatted_text_box "Chemist: Hills above Rodeo. Follow the wall up from the road."
    wait 4000
        0ACE: show_formatted_text_box "Chemist: Get close and look for the sign. Bring product. Come alone."
        wait 4000
        $chemistCallDone = 1
        if
            $chemistQuestionBlip == -1
        then
            04CE: add_short_range_sprite_blip_for_coord 475.1535 -1143.6329 68.5578 sprite 37 store_to $chemistQuestionBlip
        end
        print_string_now "CHEMIST CLUE~n~Hills above Rodeo" 6000
else
    print_string_now "Morgan is marked on the map" 5000
end
return

:PLANT_COCA
if
    $cocaPlanted == 0
then
    if
        $mysterySeeds > 0
    then
        $mysterySeeds -= 1
        gosub @DO_COCA_PLANT
        print_string_now "Mystery seed planted" 4000
    else
        if
            $cocaSeeds > 0
        then
            $cocaSeeds -= 1
            gosub @DO_COCA_PLANT
            print_string_now "Coca seed planted" 4000
        else
            print_string_now "You have no mystery or coca seeds" 3000
        end
    end
else
    print_string_now "You already have coca growing" 3000
end
return

:DO_COCA_PLANT
04ED: load_animation "BOMBER"
wait 500
0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 7000
wait 7000
04EF: release_animation "BOMBER"
04C4: get_offset_from_char_in_world_coords $scplayer offset 0.0 1.0 0.0 store_to $cocaX $cocaY $cocaZ
$cocaZ -= 2.8
01BD: nowTime = current_time_in_ms
request_model #GENVEG_BUSH17
while not has_model_loaded #GENVEG_BUSH17
    wait 0
end
$cocaPlant = create_object #GENVEG_BUSH17 at $cocaX $cocaY $cocaZ
08D2: set_object_scale $cocaPlant to 0.25
mark_model_as_no_longer_needed #GENVEG_BUSH17
$cocaPlanted = 1
$cocaReady = 0
$cocaStage = 1
$cocaStart = nowTime
$cocaStart += 1
$cocaGrowTicks = 0
return

:COCA_ADVANCE_STAGE_2
delete_object $cocaPlant
$cocaZ += 0.5
request_model #GENVEG_BUSH17
while not has_model_loaded #GENVEG_BUSH17
    wait 0
end
$cocaPlant = create_object #GENVEG_BUSH17 at $cocaX $cocaY $cocaZ
08D2: set_object_scale $cocaPlant to 0.45
mark_model_as_no_longer_needed #GENVEG_BUSH17
$cocaStage = 2
print_string_now "Mystery plant is growing" 3000
return

:COCA_ADVANCE_STAGE_3
delete_object $cocaPlant
$cocaZ += 0.5
request_model #GENVEG_BUSH17
while not has_model_loaded #GENVEG_BUSH17
    wait 0
end
$cocaPlant = create_object #GENVEG_BUSH17 at $cocaX $cocaY $cocaZ
08D2: set_object_scale $cocaPlant to 0.65
mark_model_as_no_longer_needed #GENVEG_BUSH17
$cocaStage = 3
$cocaReady = 1
0188: add_blip_for_object $cocaPlant store_to $cocaBlip
0165: change_blip_colour $cocaBlip to 2
018B: change_blip_display $cocaBlip to 3
print_string_now "COCA PLANT READY~n~Harvest possible" 5000
return

:HARVEST_COCA
04ED: load_animation "BOMBER"
wait 500
0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 6000
wait 6000
04EF: release_animation "BOMBER"
$cocaLeaves += 40
$cocaSeeds += 2
if
    $cocaBlip <> -1
then
    0164: remove_blip $cocaBlip
    $cocaBlip = -1
end
delete_object $cocaPlant
$cocaPlanted = 0
$cocaReady = 0
$cocaStage = 0
$cocaPrompt = 0
$cocaGrowTicks = 0
print_string_now "COCA HARVESTED~n~40 leaves, 2 seeds" 6000
wait 3000
print_string_now "Bring coca leaves to Morgan" 5000
return

:SPAWN_CHEMIST
$chemistSpawned = 1
request_model 70
while not has_model_loaded 70
    wait 0
end
$chemist = create_char 4 70 at 475.1535 -1143.6329 68.5578
set_char_heading $chemist 94.0
wait 1000
freeze_char_position $chemist True
mark_model_as_no_longer_needed 70
return

:CHEMIST_TALK
if
    $chemistBlip == -1
then
    if
        $chemistQuestionBlip <> -1
    then
        0164: remove_blip $chemistQuestionBlip
        $chemistQuestionBlip = -1
    end
    04CE: add_short_range_sprite_blip_for_coord 475.1535 -1143.6329 68.5578 sprite 52 store_to $chemistBlip
    print_string_now "CHEMIST MARKED~n~Dollar marker added" 4000
    wait 1500
    0ACE: show_formatted_text_box "Chemist: You found the right door. That means somebody trusts you, or wants you tested."
    wait 4500
    0ACE: show_formatted_text_box "CJ: You the chemist?"
    wait 3000
    0ACE: show_formatted_text_box "Morgan: Name is Morgan. I make bad ideas profitable."
    wait 4500
end
if
    $opiumGrams > 0
then
    0ACE: show_formatted_text_box "Chemist: Crude work, but the plant does not lie."
    wait 4000
    0ACE: show_formatted_text_box "Chemist: I will refine it. Do not ask what happens in the room."
    wait 4500
    $rewardRoll = $opiumGrams
    if
        $morganFarmMoved == 1
    then
        $rewardRoll *= 2
    end
    $heroinGrams += $rewardRoll
    0AD1: show_formatted_text_highpriority "Chemist processed %dg heroin" time 5000 $rewardRoll
    $opiumGrams = 0
else
    0ACE: show_formatted_text_box "Chemist: Do not waste my evening unless you brought opium."
    wait 3500
end
return

:ENSURE_MISSION_VI_ACTIVE
if
    $mission5Started == 1
then
    if
        $mission6Started == 0
    then
        $mission6Started = 1
        $mission6SoldGrams = 0
        print_string_now "MISSION VI~n~Slinging" 4000
        wait 1500
        print_string_now "OBJECTIVE~n~Sell 100g AK-47 at Santa Maria Beach" 5000
    end
end
return

:SLING_SELL_1
gosub @ENSURE_MISSION_VI_ACTIVE
if
    $akWeedGrams > 0
then
    $akWeedGrams -= 1
    if
        $mission6Started == 1
    then
        $mission6SoldGrams += 1
    end
    $slingSalePrice = 14
    $slingSalePrice *= $slingingRepBeach
    $slingSalePrice /= 100
    $slingSalePrice += 14
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold 1g AK-47 for $%d" time 3000 $slingSalePrice
    gosub @SLING_FINISH_DEAL
else
    print_string_now "Not enough AK-47" 3000
end
return

:SLING_SELL_5
gosub @ENSURE_MISSION_VI_ACTIVE
if
    $akWeedGrams > 4
then
    $akWeedGrams -= 5
    if
        $mission6Started == 1
    then
        $mission6SoldGrams += 5
    end
    $slingSalePrice = 70
    $slingSalePrice *= $slingingRepBeach
    $slingSalePrice /= 100
    $slingSalePrice += 70
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold 5g AK-47 for $%d" time 3000 $slingSalePrice
    gosub @SLING_FINISH_DEAL
else
    print_string_now "Not enough AK-47" 3000
end
return

:SLING_SELL_20
gosub @ENSURE_MISSION_VI_ACTIVE
if
    $akWeedGrams > 19
then
    $akWeedGrams -= 20
    if
        $mission6Started == 1
    then
        $mission6SoldGrams += 20
    end
    $slingSalePrice = 280
    $slingSalePrice *= $slingingRepBeach
    $slingSalePrice /= 100
    $slingSalePrice += 280
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold 20g AK-47 for $%d" time 3000 $slingSalePrice
    gosub @SLING_FINISH_DEAL
else
    print_string_now "Not enough AK-47" 3000
end
return

:SLING_SELL_ECSTASY
if
    $ecstasyPills > 0
then
    $ecstasyPills -= 1
    $slingSalePrice = 20
    $slingSalePrice *= $slingingRepBeach
    $slingSalePrice /= 100
    $slingSalePrice += 20
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold ecstasy for $%d" time 3000 $slingSalePrice
    gosub @SLING_FINISH_DEAL
else
    print_string_now "No ecstasy" 3000
end
return

:SLING_SELL_HEROIN
if
    $heroinGrams > 0
then
    $heroinGrams -= 1
    $slingSalePrice = 60
    $slingSalePrice *= $slingingRepBeach
    $slingSalePrice /= 100
    $slingSalePrice += 60
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold heroin for $%d" time 3000 $slingSalePrice
    if
        $mission8Unlocked == 0
    then
        if
            $mission8Started == 0
        then
            $mission8Unlocked = 1
        end
    end
    gosub @SLING_FINISH_DEAL
else
    print_string_now "No heroin" 3000
end
return

:SLING_SELL_OPIUM
if
    $opiumGrams > 0
then
    $opiumGrams -= 1
    $slingSalePrice = 35
    $slingSalePrice *= $slingingRepBeach
    $slingSalePrice /= 100
    $slingSalePrice += 35
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold opium for $%d" time 3000 $slingSalePrice
    gosub @SLING_FINISH_DEAL
else
    print_string_now "No opium" 3000
end
return

:SLING_SELL_COCAINE
if
    $cocaineGrams > 0
then
    $cocaineGrams -= 1
    $slingSalePrice = 160
    $slingSalePrice *= $slingingRepBeach
    $slingSalePrice /= 100
    $slingSalePrice += 160
    0109: add_score $player1 value $slingSalePrice
    0AD1: show_formatted_text_highpriority "Sold cocaine for $%d" time 3000 $slingSalePrice
    gosub @SLING_FINISH_DEAL
else
    print_string_now "No cocaine" 3000
end
return

:HILL_REWARD
04ED: load_animation "BOMBER"
wait 500
0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 5000
wait 5000
04EF: release_animation "BOMBER"
000A: $akWeedGrams += 80
0AD1: show_formatted_text_highpriority "Harvested 80g AK-47" time 5000
$mission3Harvested += 1
return

:HARVEST_HILL_1
$hillPrompt1 = 0
gosub @HILL_REWARD
0164: remove_blip $hillPlantBlip1
delete_object $hillPlant1
$hillPlantDone1 = 1
return

:HARVEST_HILL_2
$hillPrompt2 = 0
gosub @HILL_REWARD
0164: remove_blip $hillPlantBlip2
delete_object $hillPlant2
$hillPlantDone2 = 1
return

:HARVEST_HILL_3
$hillPrompt3 = 0
gosub @HILL_REWARD
0164: remove_blip $hillPlantBlip3
delete_object $hillPlant3
$hillPlantDone3 = 1
return

:HARVEST_HILL_4
$hillPrompt4 = 0
gosub @HILL_REWARD
0164: remove_blip $hillPlantBlip4
delete_object $hillPlant4
$hillPlantDone4 = 1
return

:PALOMINO_CONTACT_TALK
print_string_now "UNKNOWN CONTACT" 3000
wait 2500
0ACE: show_formatted_text_box "Contact: I see opportunity in you, CJ."
wait 3500
0ACE: show_formatted_text_box "Contact: You are making noise, but noise can be useful."
wait 4000
0ACE: show_formatted_text_box "Contact: Pay the right cash and I can look after things at the department."
wait 4500
0ACE: show_formatted_text_box "Contact: Small bribe is cheap. Medium is safer. Large clears real heat."
wait 4500
print_string_now "BRIBES UNLOCKED~n~1 small 2 medium 3 large" 6000
$palominoContactTalked = 1
$palominoPrompt = 0
return

:BRIBE_SMALL
if
    010A: is_score_greater $player1 than 249
then
    0109: add_score $player1 value -250
    $drugHeat -= 5
    if
        $drugHeat < 0
    then
        $drugHeat = 0
    end
    gosub @CHECK_HEAT_PRESSURE
    0AD1: show_formatted_text_highpriority "Small bribe paid~n~Heat:%d" time 4000 $drugHeat
else
    print_string_now "Not enough money" 3000
end
return

:BRIBE_MEDIUM
if
    010A: is_score_greater $player1 than 749
then
    0109: add_score $player1 value -750
    $drugHeat -= 15
    if
        $drugHeat < 0
    then
        $drugHeat = 0
    end
    gosub @CHECK_HEAT_PRESSURE
    0AD1: show_formatted_text_highpriority "Medium bribe paid~n~Heat:%d" time 4000 $drugHeat
else
    print_string_now "Not enough money" 3000
end
return

:BRIBE_LARGE
if
    010A: is_score_greater $player1 than 1499
then
    0109: add_score $player1 value -1500
    $drugHeat -= 30
    if
        $drugHeat < 0
    then
        $drugHeat = 0
    end
    gosub @CHECK_HEAT_PRESSURE
    0AD1: show_formatted_text_highpriority "Large bribe paid~n~Heat:%d" time 4000 $drugHeat
else
    print_string_now "Not enough money" 3000
end
return

:PLANT_REGULAR
if
    $planted1 == 0
then
    seedPacks -= 1
    04ED: load_animation "BOMBER"
    wait 500
    0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 10000
    wait 10000
    04EF: release_animation "BOMBER"
    04C4: get_offset_from_char_in_world_coords $scplayer offset 0.0 1.0 0.0 store_to $plant1X $plant1Y $plant1Z
    $plant1Z -= 1.4
    $planted1 = 1
    $plantType1 = 1
    $plantReady1 = 0
    $growStage1 = 0
    $harvestPrompt1 = 0
    $plantStart1 = nowTime
    print_string_now "Cannabis planted successfully" 4000
    if
        missionStage == 2
    then
        missionStage = 3
        print_string_now "OBJECTIVE~n~Wait for the plant to grow" 5000
    end
else
    if
        $planted2 == 0
    then
        if
            maxPlants > 1
        then
            seedPacks -= 1
            04ED: load_animation "BOMBER"
            wait 500
            0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 10000
            wait 10000
            04EF: release_animation "BOMBER"
            04C4: get_offset_from_char_in_world_coords $scplayer offset 0.0 1.0 0.0 store_to $plant2X $plant2Y $plant2Z
            $plant2Z -= 1.4
            $planted2 = 1
            $plantType2 = 1
            $plantReady2 = 0
            $growStage2 = 0
            $harvestPrompt2 = 0
            $plantStart2 = nowTime
            print_string_now "Cannabis planted successfully" 4000
            if
                missionStage == 2
            then
                missionStage = 3
                print_string_now "OBJECTIVE~n~Wait for the plant to grow" 5000
            end
        else
            print_string_now "You cannot grow more plants yet" 3000
        end
    else
        print_string_now "You cannot grow more plants yet" 3000
    end
end
return

:PLANT_AK
if
    $planted1 == 0
then
    $akSeedPacks -= 1
    04ED: load_animation "BOMBER"
    wait 500
    0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 10000
    wait 10000
    04EF: release_animation "BOMBER"
    04C4: get_offset_from_char_in_world_coords $scplayer offset 0.0 1.0 0.0 store_to $plant1X $plant1Y $plant1Z
    $plant1Z -= 1.4
    $planted1 = 1
    $plantType1 = 2
    $plantReady1 = 0
    $growStage1 = 0
    $harvestPrompt1 = 0
    $plantStart1 = nowTime
    print_string_now "AK-47 cannabis planted" 4000
else
    if
        $planted2 == 0
    then
        if
            maxPlants > 1
        then
            $akSeedPacks -= 1
            04ED: load_animation "BOMBER"
            wait 500
            0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 10000
            wait 10000
            04EF: release_animation "BOMBER"
            04C4: get_offset_from_char_in_world_coords $scplayer offset 0.0 1.0 0.0 store_to $plant2X $plant2Y $plant2Z
            $plant2Z -= 1.4
            $planted2 = 1
            $plantType2 = 2
            $plantReady2 = 0
            $growStage2 = 0
            $harvestPrompt2 = 0
            $plantStart2 = nowTime
            print_string_now "AK-47 cannabis planted" 4000
        else
            print_string_now "You cannot grow more plants yet" 3000
        end
    else
        print_string_now "You cannot grow more plants yet" 3000
    end
end
return

:HARVEST_PLANT1
04ED: load_animation "BOMBER"
wait 500
0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 10000
wait 10000
04EF: release_animation "BOMBER"
if
    $plantBlip1 <> -1
then
    0164: remove_blip $plantBlip1
end
delete_object $weedPlant1
if
    $plantType1 == 2
then
    $akWeedGrams += 75
    if
        $mission4Started == 1
    then
        if
            $mission4Complete == 0
        then
            $mission4AkHarvested += 1
            0AD1: show_formatted_text_highpriority "Harvested 75g AK-47~n~Mission IV progress:%d/2" time 5000 $mission4AkHarvested
            if
                $mission4AkHarvested > 1
            then
                $mission4Complete = 1
                print_string_now "MISSION PASSED~n~AK-47 Reserve" 6000
                wait 3500
                gosub @START_MISSION_V
            end
        else
            print_string_now "Harvested 75g AK-47" 4000
        end
    else
        print_string_now "Harvested 75g AK-47" 4000
    end
else
    weedGrams += 50
    000A: $regularHarvestedGrams += 50
    000A: $harvestedCrops += 1
    if
        $mission2Complete == 0
    then
        if
            $mission2Ready == 0
        then
            $mission2Ready = 1
        else
            if
                $mission2Ready == 1
            then
                $mission2Ready = 2
            end
        end
        0AD1: show_formatted_text_highpriority "Harvested 50g weed~n~Total regular harvested: %dg~n~Mission II progress:%d/2" time 5000 $regularHarvestedGrams $mission2Ready
    else
        if
            $mission3Unlocked == 0
        then
            if
                $mission3Ready == 0
            then
                $mission3Ready = 1
            else
                if
                    $mission3Ready == 1
                then
                    $mission3Ready = 2
                else
                    $mission3Ready = 3
                end
            end
            0AD1: show_formatted_text_highpriority "Harvested 50g weed~n~Mission III progress:%d/3" time 5000 $mission3Ready
            if
                $mission3Ready == 3
            then
                $mission3Unlocked = 1
                print_string_now "MISSION III UNLOCKED~n~Talk to the supplier" 6000
            end
        else
            print_string_now "Harvested 50g weed" 4000
        end
    end
end
$planted1 = 0
$plantReady1 = 0
$growStage1 = 0
$harvestPrompt1 = 0
$plantType1 = 0
$plantBlip1 = -1
if
    $mission2Ready == 2
then
    if
        $mission2Complete == 0
    then
        if
            $mission2Started == 0
        then
            $mission2Unlocked = 1
            maxPlants = 2
            print_string_now "MISSION II AVAILABLE~n~Return to the supplier and press T" 6000
        end
    end
end
if
    missionStage == 3
then
    missionStage = 4
    0ACE: show_formatted_text_box "CJ remembers an uncle of an old Grove friend who likes weed."
    wait 3500
    0ACE: show_formatted_text_box "He lives near the big tall complexes with yards near Grove Street."
    wait 4000
    0ACE: show_formatted_text_box "He might buy what you harvested."
    wait 3500
    print_string_now "OBJECTIVE~n~Sell the marijuana" 5000
end
return

:HARVEST_PLANT2
04ED: load_animation "BOMBER"
wait 500
0812: task_play_anim_non_interruptable $scplayer anim "BOM_Plant" ifp "BOMBER" framedelta 4.0 loop 0 lockX 1 lockY 1 lockF 0 time 10000
wait 10000
04EF: release_animation "BOMBER"
if
    $plantBlip2 <> -1
then
    0164: remove_blip $plantBlip2
end
delete_object $weedPlant2
if
    $plantType2 == 2
then
    $akWeedGrams += 75
    if
        $mission4Started == 1
    then
        if
            $mission4Complete == 0
        then
            $mission4AkHarvested += 1
            0AD1: show_formatted_text_highpriority "Harvested 75g AK-47~n~Mission IV progress:%d/2" time 5000 $mission4AkHarvested
            if
                $mission4AkHarvested > 1
            then
                $mission4Complete = 1
                print_string_now "MISSION PASSED~n~AK-47 Reserve" 6000
                wait 3500
                gosub @START_MISSION_V
            end
        else
            print_string_now "Harvested 75g AK-47" 4000
        end
    else
        print_string_now "Harvested 75g AK-47" 4000
    end
else
    weedGrams += 50
    000A: $regularHarvestedGrams += 50
    000A: $harvestedCrops += 1
    if
        $mission2Complete == 0
    then
        if
            $mission2Ready == 0
        then
            $mission2Ready = 1
        else
            if
                $mission2Ready == 1
            then
                $mission2Ready = 2
            end
        end
        0AD1: show_formatted_text_highpriority "Harvested 50g weed~n~Total regular harvested: %dg~n~Mission II progress:%d/2" time 5000 $regularHarvestedGrams $mission2Ready
    else
        if
            $mission3Unlocked == 0
        then
            if
                $mission3Ready == 0
            then
                $mission3Ready = 1
            else
                if
                    $mission3Ready == 1
                then
                    $mission3Ready = 2
                else
                    $mission3Ready = 3
                end
            end
            0AD1: show_formatted_text_highpriority "Harvested 50g weed~n~Mission III progress:%d/3" time 5000 $mission3Ready
            if
                $mission3Ready == 3
            then
                $mission3Unlocked = 1
                print_string_now "MISSION III UNLOCKED~n~Talk to the supplier" 6000
            end
        else
            print_string_now "Harvested 50g weed" 4000
        end
    end
end
$planted2 = 0
$plantReady2 = 0
$growStage2 = 0
$harvestPrompt2 = 0
$plantType2 = 0
$plantBlip2 = -1
if
    $mission2Ready == 2
then
    if
        $mission2Complete == 0
    then
        if
            $mission2Started == 0
        then
            $mission2Unlocked = 1
            maxPlants = 2
            print_string_now "MISSION II AVAILABLE~n~Return to the supplier and press T" 6000
        end
    end
end
if
    missionStage == 3
then
    missionStage = 4
    0ACE: show_formatted_text_box "CJ remembers an uncle of an old Grove friend who likes weed."
    wait 3500
    0ACE: show_formatted_text_box "He lives near the big tall complexes with yards near Grove Street."
    wait 4000
    0ACE: show_formatted_text_box "He might buy what you harvested."
    wait 3500
    print_string_now "OBJECTIVE~n~Sell the marijuana" 5000
end
return

:AFTER_REGULAR_SALE
if
    firstSaleTextShown == 0
then
    if
        missionStage == 4
    then
        firstSaleTextShown = 1
        0ACE: show_formatted_text_box "This stuff isn't terrible, but it's low-grade."
        wait 3000
        0ACE: show_formatted_text_box "Nobody's paying top dollar for this quality."
        wait 3000
        print_string_now "Unlock better strains through progression" 5000
    else
        if
            missionStage > 4
        then
            firstSaleTextShown = 1
        end
    end
end

if
    missionStage == 4
then
    missionStage = 5
    print_string_now "MISSION PASSED~n~First Harvest" 5000
end
return

:AFTER_AK_SALE
if
    $akFirstSaleCallShown == 0
then
    if
        $akFirstSaleCallPending == 0
    then
        $akFirstSaleCallPending = 1
        $akSaleCallStart = nowTime
    end
end
return

:CHECK_HEAT_PRESSURE
if
    $drugHeat > 99
then
    if
        heatLevel < 4
    then
        heatLevel = 4
        print_string_now "HEAT CRITICAL~n~Customers avoid you and routes stop" 6000
        wait 2500
        0ACE: show_formatted_text_box "Word is moving too fast. Pay the Palomino contact before pushing product."
    end
    return
end
if
    $drugHeat > 74
then
    if
        heatLevel < 3
    then
        heatLevel = 3
        print_string_now "HEAT HIGH~n~Smuggling is getting dangerous" 5000
    end
    return
end
if
    $drugHeat > 49
then
    if
        heatLevel < 2
    then
        heatLevel = 2
        print_string_now "HEAT RISING~n~People are noticing the operation" 5000
    end
    return
end
if
    $drugHeat > 24
then
    if
        heatLevel < 1
    then
        heatLevel = 1
        print_string_now "HEAT NOTICE~n~Keep the business quiet" 4000
    end
    return
end
if
    heatLevel > 0
then
    heatLevel = 0
    print_string_now "HEAT LOW~n~Business can move again" 4000
end
return

:DRAW_DRUG_MENU_PROTOTYPE
if
    $drugMenuPage == 1
then
    if
        $cocaineBreakthroughDone == 1
    then
        0AD1: show_formatted_text_highpriority "BLACK MARKET~n~PRODUCTS 1/4~n~Weed:%dg AK:%dg XTC:%d~n~Opium:%dg Heroin:%dg Coke:%dg~n~F6 NEXT | N CLOSE" time 1000 weedGrams $akWeedGrams $ecstasyPills $opiumGrams $heroinGrams $cocaineGrams
    else
        if
            $chemistUnlocked == 1
        then
            0AD1: show_formatted_text_highpriority "BLACK MARKET~n~PRODUCTS 1/4~n~Weed:%dg AK:%dg XTC:%d~n~Opium:%dg Heroin:%dg~n~F6 NEXT | N CLOSE" time 1000 weedGrams $akWeedGrams $ecstasyPills $opiumGrams $heroinGrams
        else
            if
                $ecstasyDealerDeals > 0
            then
                0AD1: show_formatted_text_highpriority "BLACK MARKET~n~PRODUCTS 1/4~n~Weed:%dg AK:%dg XTC:%d~n~F6 NEXT | N CLOSE" time 1000 weedGrams $akWeedGrams $ecstasyPills
            else
                if
                    $mission2Complete == 1
                then
                    0AD1: show_formatted_text_highpriority "BLACK MARKET~n~PRODUCTS 1/4~n~Weed:%dg AK:%dg~n~F6 NEXT | N CLOSE" time 1000 weedGrams $akWeedGrams
                else
                    0AD1: show_formatted_text_highpriority "BLACK MARKET~n~PRODUCTS 1/4~n~Weed:%dg~n~F6 NEXT | N CLOSE" time 1000 weedGrams
                end
            end
        end
    end
else
    if
        $drugMenuPage == 2
    then
        if
            $cocaineBreakthroughDone == 1
        then
            0AD1: show_formatted_text_highpriority "BLACK MARKET~n~SEEDS 2/4~n~Cannabis:%d AK:%d Poppy:%d~n~Mystery:%d Coca:%d Leaves:%dg~n~F6 NEXT | N CLOSE" time 1000 seedPacks $akSeedPacks $poppySeeds $mysterySeeds $cocaSeeds $cocaLeaves
        else
            if
                $empirePhaseUnlocked == 1
            then
                0AD1: show_formatted_text_highpriority "BLACK MARKET~n~SEEDS 2/4~n~Cannabis:%d AK:%d Poppy:%d~n~Mystery:%d~n~F6 NEXT | N CLOSE" time 1000 seedPacks $akSeedPacks $poppySeeds $mysterySeeds
            else
                if
                    $mission7Started > 0
                then
                    0AD1: show_formatted_text_highpriority "BLACK MARKET~n~SEEDS 2/4~n~Cannabis:%d AK:%d Poppy:%d~n~F6 NEXT | N CLOSE" time 1000 seedPacks $akSeedPacks $poppySeeds
                else
                    if
                        $mission2Complete == 1
                    then
                        0AD1: show_formatted_text_highpriority "BLACK MARKET~n~SEEDS 2/4~n~Cannabis:%d AK:%d~n~F6 NEXT | N CLOSE" time 1000 seedPacks $akSeedPacks
                    else
                        0AD1: show_formatted_text_highpriority "BLACK MARKET~n~SEEDS 2/4~n~Cannabis:%d~n~F6 NEXT | N CLOSE" time 1000 seedPacks
                    end
                end
            end
        end
    else
        if
            $drugMenuPage == 3
        then
            if
                $nightlifeSlingingUnlocked == 1
            then
                0AD1: show_formatted_text_highpriority "BLACK MARKET~n~STATUS 3/4~n~Heat:%d~n~Beach rep:%d Night rep:%d~n~Deals:%d Dealer trust:%d~n~F6 NEXT | N CLOSE" time 1000 $drugHeat $slingingRepBeach $nightlifeRep $slingDeals $ecstasyDealerStage
            else
                if
                    $slingingUnlocked == 1
                then
                    0AD1: show_formatted_text_highpriority "BLACK MARKET~n~STATUS 3/4~n~Heat:%d~n~Beach rep:%d~n~Deals:%d Dealer trust:%d~n~F6 NEXT | N CLOSE" time 1000 $drugHeat $slingingRepBeach $slingDeals $ecstasyDealerStage
                else
                    0AD1: show_formatted_text_highpriority "BLACK MARKET~n~STATUS 3/4~n~Heat:%d~n~F6 NEXT | N CLOSE" time 1000 $drugHeat
                end
            end
        else
            if
                $mayaUnlocked == 1
            then
                0AD1: show_formatted_text_highpriority "BLACK MARKET~n~CONTACTS 4/4~n~Buyer Isaac Morgan~n~Tyrell Maya Nightlife~n~F6 NEXT | N CLOSE" time 1000
            else
                if
                    $chemistUnlocked == 1
                then
                    0AD1: show_formatted_text_highpriority "BLACK MARKET~n~CONTACTS 4/4~n~Buyer Isaac Morgan~n~Tyrell~n~F6 NEXT | N CLOSE" time 1000
                else
                    if
                        $ecstasyDealerDeals > 0
                    then
                        0AD1: show_formatted_text_highpriority "BLACK MARKET~n~CONTACTS 4/4~n~Buyer Isaac Dealer~n~F6 NEXT | N CLOSE" time 1000
                    else
                        if
                            $isaacDiscovered == 1
                        then
                            0AD1: show_formatted_text_highpriority "BLACK MARKET~n~CONTACTS 4/4~n~Buyer Isaac~n~F6 NEXT | N CLOSE" time 1000
                        else
                            0AD1: show_formatted_text_highpriority "BLACK MARKET~n~CONTACTS 4/4~n~Buyer~n~F6 NEXT | N CLOSE" time 1000
                        end
                    end
                end
            end
        end
    end
end
return













